安装问题
OpenClaw 安装失败:npm ERR!、权限不足或网络超时
macOSWindowsLinux
症状
运行 npm install -g openclaw@latest 时报错,常见报错信息:
npm ERR! code EACCES— 权限不足npm ERR! network timeout— 网络超时SyntaxError: Unexpected token— Node.js 版本太低
解法
权限不足(EACCES)
# macOS / Linux:不要用 sudo,改用 nvm 管理 Node
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
nvm install 22
nvm use 22
nvm alias default 22
# 重新安装
npm install -g openclaw@latest
网络超时
# 切换 npm 镜像源(中国大陆推荐)
npm config set registry https://registry.npmmirror.com
npm install -g openclaw@latest
# 或使用代理
export https_proxy=http://127.0.0.1:7890
npm install -g openclaw@latest
Node.js 版本太低
# 确认 Node.js 版本 >= 22
node -v
# 如果版本太低,用 nvm 升级
nvm install 22
nvm use 22
npm install -g openclaw@latest
验证修复
# 安装成功后验证
openclaw --version
openclaw doctor