环境说明
本次测试基于原生 Windows 11(未启用 WSL2),Node.js 版本为 24.12.0 (LTS),npm 版本 11.7.0。
安装方式
根据需求选择以下命令之一:
- 通用安装(推荐):
npm install -g openclaw@latest - 官方测试版:
curl -fsSL https://openclaw.ai/install.cmd -o install.cmd && install.cmd --tag beta && del install.cmd
常见问题排查
1. 缺少 Git 依赖工具
如果执行安装时出现 npm error code ENOENT / syscall spawn git / 找不到 Git 文件,说明系统未安装 Git。npm 在拉取源码时需要调用 Git 命令。
修复步骤:
- 访问 Git 官网下载 Windows 安装包。
- 运行安装程序,全程保持默认设置即可。
- 关键一步:安装过程中务必勾选
Git from the command line and also from 3rd-party software,这会自动配置环境变量,无需手动操作。 - 关闭所有终端窗口重新打开,输入
git --version确认安装成功。
2. GitHub 权限验证失败
若已安装 Git 但仍报错 [email protected]: Permission denied (publickey) / code 128,通常是因为 Git 默认使用 SSH 协议访问 GitHub,而本地未配置密钥。此时可以强制 Git 使用 HTTPS 协议来绕过验证。
注意: 直接在 PowerShell 中通过命令行修改配置可能会因解析 Bug 导致规则被覆盖,建议手动编辑配置文件。
操作步骤:
- 在终端输入路径
C:\Users\你的用户名\.gitconfig并回车,用记事本打开该文件。 - 删除文件中关于 URL 映射的旧内容,粘贴以下配置:
[url "https://gitclone.com/github.com/"]
insteadOf = [email protected]:
insteadOf = ssh://[email protected]/
insteadOf = https://github.com/
此配置将强制所有 GitHub 请求走 HTTPS 镜像通道。 3. 保存文件后,回到终端清理缓存并重新安装:
npm cache clean --force
npm install -g openclaw@latest
如果在安装过程中遇到拿不准的步骤,可以先跳过(skip),后续通过 openclaw onboard 命令回来补充配置。

