一、项目简介
近期 Clawdbot(Moltbot)因支持私人 AI 助手及多通道接入受到关注。本文基于 GitHub 仓库进行源码部署实践,记录环境搭建与配置过程中的关键步骤。
二、环境准备:WSL2 优先
Windows 环境下推荐直接使用 WSL2(Ubuntu/Debian 镜像),后续操作均在 WSL2 中完成:
- 启用 WSL2:在 Windows 功能中勾选'适用于 Linux 的 Windows 子系统'和'虚拟机平台',重启后安装 Ubuntu 22.04。
- 配置系统:更新源(建议换阿里源),执行
sudo apt update && sudo apt upgrade -y。 - 安装 Git:
sudo apt install git,验证git --version。
三、Node.js 版本管理
仓库文档要求 Node.js ≥ 22。建议使用 nvm 管理环境并切换至最新版本。
注意:Node.js 版本需大于等于 22,否则 pnpm install 可能报错。
四、拉取源码与依赖安装
1. 克隆与安装
git clone https://github.com/openclaw/openclaw.git
cd openclaw
pnpm install
若遇到 node-llama-cpp 的 postinstall 脚本失败(错误码 3221225477),通常表示访问冲突或缺少构建工具。该依赖为可选,仅用于本地嵌入。若使用远程嵌入(如 OpenAI),可忽略此错误。项目会回退到远程嵌入。
解决方案:注释掉 package.json 中的 node-llama-cpp 依赖,重新执行 pnpm install。
2. 构建项目
先构建 UI:
pnpm ui:build
再构建主项目:
pnpm build
若在原生 Windows 上构建报错,需检查是否有 Git Bash 可用。可在项目的 /script 目录下创建 Node.js 版本的构建脚本 bundle-a2ui.mjs:
#!/usr/bin/env node
import { createHash } from "node:crypto";
import { promises as fs } from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
import { spawn } from "node:child_process";
import { promisify } ;
spawnAsync = (spawn);
__filename = (..);
__dirname = path.(__filename);
= path.(__dirname, );
= path.(, );
= path.(, );
= path.(, );
= path.(, );
() {
{
stat = fs.(dir);
stat.();
} {
;
}
}
() {
st = fs.(entryPath);
(st.()) {
entries = fs.(entryPath);
( entry entries) {
(path.(entryPath, entry), files);
}
files;
}
files.(entryPath);
files;
}
() {
p.(path.).();
}
() {
inputPaths = [
path.(, ),
path.(, ),
,
,
];
files = [];
( inputPath inputPaths) {
{
stat = fs.(inputPath);
(stat.() || stat.()) {
(inputPath, files);
}
} {
}
}
files.( (a).((b)));
hash = ();
( filePath files) {
rel = (path.(, filePath));
hash.(rel);
hash.();
content = fs.(filePath);
hash.(content);
hash.();
}
hash.();
}
() {
( {
proc = (command, args, {
...options,
: ,
: ,
});
proc.(, {
(code === ) {
();
} {
( ());
}
});
proc.(, reject);
});
}
() {
{
(!( ()) || !( ())) {
.();
process.();
}
currentHash = ();
shouldBuild = ;
{
previousHash = fs.(, );
outputExists = fs.().( ).( );
(previousHash.() === currentHash && outputExists) {
.();
shouldBuild = ;
}
} {
}
(shouldBuild) {
.();
(, [, , , , path.(, )]);
(, [, , , , path.(, )]);
fs.(, currentHash, );
.();
}
} (error) {
.();
.();
.(error);
process.();
}
}
();



验证了其工具调用及 Computer Use 能力。