如何在 Windows 上使用小龙虾(OpenClaw)

如何在 Windows 上使用小龙虾(OpenClaw)

本文记录了在 Windows 11 上部署 OpenClaw 的完整过程,包括问题诊断与解决方案。

背景

用户从 GitHub 下载了 OpenClaw(小龙虾)项目,计划在 Windows 11 上部署使用。

第一步:安装 Node.js v22

部署 OpenClaw 需要 Node.js v22 以上版本。

推荐方案(使用 fnm 版本管理):

winget install Schniz.fnm
fnm install 22

配置 PowerShell 环境:

# 检查并创建配置文件
if (!(Test-Path $PROFILE)) {
    New-Item -ItemType File -Path $PROFILE -Force
}

# 追加 fnm 启动配置
Add-Content $PROFILE "`nfnm env --use-on-cd | Out-String | Invoke-Expression"

# 重新加载配置
. $PROFILE
fnm use 22
node -v

开启脚本执行权限(如遇报错):

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

第二步:换源(解决国内下载慢)

npm config set registry https://registry.npmmirror.com/

第三步:下载 OpenClaw 源码

cd C:\
mkdir OpenClaw
cd OpenClaw
git clone https://github.com/openclaw/openclaw.git .

⚠️ 常见错误:仓库地址填成了 StartAI-Lab/OpenClaw(不存在),正确地址是 openclaw/openclaw。


第四步:安装依赖

pnpm install

如果报错提示缺少 Python 或 C++ 编译工具,运行:

npm install --global --production windows-build-tools

第五步:配置模型(MiniMax 为例)

运行配置命令:

pnpm start -- configure

配置步骤:

  1. 选择运行位置:Local (this machine)
  2. 选择 LLM 提供商:MiniMax M2.5 (CN)(或 OpenAI Compatible)
  3. 填入 API Key(MiniMax 的 sk-cp- 开头的密钥)
  4. 模型名称:abab6.5s-chat
  5. 其他选项一路回车确认

备选方案:如果 MiniMax 选项复杂,可使用 OpenAI Compatible 模式:

  • Base URL: https://api.minimax.chat/v1
  • API Key: 你的 MiniMax Key
  • Model: abab6.5s-chat

第六步:启动网关

pnpm start -- gateway

看到以下输出即表示成功:

Gateway running at http://localhost:3000

第七步:打开控制面板

保持网关窗口不关闭,另开一个 PowerShell 窗口:

cd C:\OpenClaw
pnpm start -- dashboard

然后在浏览器访问 http://localhost:3000 即可开始使用。

image


常见问题速查

问题 解决方案
node 命令找不到 配置 fnm 环境变量,重启 PowerShell
GitHub 克隆超时 使用代理:https://mirror.ghproxy.com/https://github.com/openclaw/openclaw.git
依赖安装失败 安装 windows-build-tools

总结

Windows 部署 OpenClaw 的核心难点在于:

  1. Node.js 环境配置(fnm)
  2. 国内网络换源
  3. 模型提供商的选择与配置

按照本教程一步步操作,可顺利完成部署。

posted @ 2026-03-07 21:18  菠萝包与冰美式  阅读(1799)  评论(0)    收藏  举报