OpenClaw 安装排错笔记(Windows + nvm + Git)
OpenClaw 安装排错笔记(Windows + nvm + Git)
一、环境目标
安装并运行OpenClawCLI 工具。
最终成功运行:
openclaw onboard--flowquickstart输出:
🦞 OpenClaw 2026.3.2 Runs on a Raspberry Pi. Dreams of a rack in Iceland.说明安装成功。
二、环境组件
本次涉及的关键工具:
| 工具 | 作用 |
|---|---|
| Node.js | JavaScript 运行环境 |
| npm | Node 包管理器 |
| nvm | Node 版本管理 |
| Git | 代码仓库管理 |
| GitHub | 依赖下载源 |
| 代理软件 | 访问 GitHub |
三、完整安装流程
1 安装 nvm
Windows 使用nvm-windows
安装后:
nvminstall22nvm use22检查版本:
node-vnpm-v结果:
node v22.22.0 npm 11.11.0四、安装 OpenClaw
运行官方安装脚本:
iwr-useb https://openclaw.ai/install.ps1|iex五、遇到的问题与解决方案
问题 1:Node 版本过高
最开始系统 Node:
Node v24安装时报错:
npm error code 128原因:
OpenClaw 依赖库不兼容 Node 24。
解决:
使用nvm 切换 Node 22
nvm use 22问题 2:系统 Node 未被 nvm 接管
安装脚本检测:
Node.js v24 found原因:
系统 PATH 中仍有旧 Node。
解决:
卸载系统 Node,仅使用 nvm。
问题 3:GitHub 访问失败
错误:
npm error code 128进一步检查:
git ls-remote https://github.com/npm/cli.git报错:
Failed to connect to github.com port 443说明:
Git 无法访问GitHub。
问题 4:Git 代理配置错误
发现 Git 配置:
mirror.ghproxy.com fastgit这些镜像已经失效。
解决:
删除配置:
gitconfig--global--unseturl."https://mirror.ghproxy.com/https://github.com/".insteadOfgitconfig--global--unseturl."https://hub.fastgit.org/".insteadOf问题 5:代理端口错误
代理软件端口:
127.0.0.1:7897但 Git 未配置代理。
解决:
gitconfig--globalhttp.proxy http://127.0.0.1:7897gitconfig--globalhttps.proxy http://127.0.0.1:7897六、验证 Git 网络
测试:
gitls-remote https://github.com/npm/cli.git成功返回:
hash refs/heads/main ...说明 GitHub 网络正常。
七、重新安装 OpenClaw
再次执行:
iwr-useb https://openclaw.ai/install.ps1|iex安装成功。
八、启动 OpenClaw
运行:
openclaw onboard--flowquickstart输出:
OpenClaw 2026.3.2说明 CLI 成功安装。
九、最终环境状态
Node:
v22.22.0npm:
11.11.0Git:
2.37.1代理:
127.0.0.1:7897GitHub 连接:
正常OpenClaw:
已成功运行十、关键经验总结
1 Node 项目常见失败原因
优先检查:
1️⃣ Node 版本
2️⃣ GitHub 网络
3️⃣ Git 代理
4️⃣ npm registry
2 npm error 128 的真正含义
通常表示:
Git clone 失败而不是 npm 本身问题。
3 Windows 常见环境坑
| 问题 | 原因 |
|---|---|
| Node 版本冲突 | 系统 Node + nvm |
| GitHub 无法访问 | 网络或代理 |
| fastgit / ghproxy | 镜像失效 |
| npm error 128 | Git 失败 |
十一、最终成功环境结构
Windows ├─ nvm │ └─ Node 22 │ ├─ npm │ ├─ Git │ └─ proxy 127.0.0.1:7897 │ └─ OpenClaw CLI十二、一键验证环境
以后可以快速测试:
node -v npm -v git --version git ls-remote https://github.com/npm/cli.git openclaw --version