前言
OpenClaw 安装环境:原生 Windows 11(未安装 WSL2),Node.js 24.12.0 (LTS),npm 11.7.0。
一、安装命令
通用 npm 安装命令如下,用于获取最新稳定版:
npm install -g openclaw@latest
官方提供的测试版(Beta)安装脚本为:
curl -fsSL https://openclaw.ai/install.cmd -o install.cmd && install.cmd --tag beta && del install.cmd
二、缺少依赖工具
报错信息:npm error code ENOENT / syscall spawn git / 找不到 Git 文件
问题根源:电脑未安装 Git 工具。npm 在安装 OpenClaw 时需要调用 Git 拉取源码,若系统找不到 Git 可执行文件,命令便会失败。
解决方案:
- 访问 Git 官网下载页面:https://git-scm.com/download/win
- 下载 Windows 版本的安装包。
- 双击运行,全程默认'下一步'即可。
- 关键步骤:安装过程中务必勾选
Git from the command line and also from 3rd-party software,这样会自动配置系统环境变量,无需手动设置。 - 关闭当前所有终端窗口,重新打开一个新的终端,输入
git --version验证是否安装成功。
三、缺少 GitHub 权限
报错信息:安装 Git 后执行命令,提示 [email protected]: Permission denied (publickey) / code 128
问题根源:Git 默认使用 SSH 协议访问 GitHub,如果电脑未配置 GitHub SSH 密钥,就没有访问权限。此时我们需要强制 Git 使用 HTTPS 协议,暂时绕过密钥验证。
解决方案:
- 在终端中定位到 Git 配置文件。路径通常为
%USERPROFILE%\.gitconfig。 注意:如果在 PowerShell 中直接通过git config命令修改相同域名的配置,可能会因为解析 Bug 导致规则被覆盖,仅最后一条生效。建议直接用记事本打开该文件进行编辑。 - 打开文件后,删除原有内容,粘贴以下配置以强制将 GitHub 的 SSH/HTTPS 地址替换为镜像源:
[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 命令回来修改配置。

