环境说明
本次操作基于原生 Windows 11(未启用 WSL2),Node.js 版本为 24.12.0 (LTS),npm 版本 11.7.0。
安装命令
通用方式安装最新稳定版:
npm install -g openclaw@latest
若需测试版(beta),可使用官方脚本:
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。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,说明 SSH 协议访问被拦截。此时可强制 Git 使用 HTTPS 协议绕过密钥验证。
修改配置:
找到并编辑 .gitconfig 文件。路径通常为 %USERPROFILE%\.gitconfig,可用记事本打开。
执行以下命令查看现有 URL 规则:
git config --global --get-regexp url
清空该文件中所有内容,替换为以下配置(通过镜像源强制跳转):
[url "https://gitclone.com/github.com/"]
insteadOf = [email protected]:
[url "https://gitclone.com/github.com/"]
insteadOf = ssh://[email protected]/
[url "https://gitclone.com/github.com/"]
insteadOf = https://github.com/
保存后继续执行安装命令:
npm cache clean --force
npm install -g openclaw@latest
提示:安装过程中若遇到拿不准的步骤,可暂时跳过,后续使用
openclaw onboard命令回来修正配置。

