作者:CSDN博客 OpenClaw 官方主要推荐在 WSL2 (Windows Subsystem for Linux) 环境下运行,而在原生 Windows (Native Windows) 上运行可能会遇到兼容性问题。
一、安装 WSL2 (Ubuntu 20.04)
1)使用命令行自动安装
在 PowerShell 中运行,或者如果想要更新的版本,使用wsl --install -d Ubuntu-22.04
(base) PS C:\Users\liu_l> wsl --install -d Ubuntu-20.04正在启动 Ubuntu 20.04 LTS...Installing, this may take a few minutes...(2)初始化新的 Ubuntu
1、它会显示 Installing, this may take a few minutes...
2、然后提示输入 新的 UNIX 用户名 (Username)。
在新的 Ubuntu 终端中,依次执行:
(1)更新系统并安装 Node.js (v22),node.js的版本不要低于v22。
sudo apt update && sudo apt upgrade -ysudo apt install -y curl git# 安装 Node.js 22curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -sudo apt-get install -y nodejs# 验证node -v # 应显示 v22.x.x(2)安装 OpenClaw
sudo npm install -g openclaw@latest如果出现下面的内容,即可说明安装成功:
liu@LEGION:~$ sudo npm install -g openclaw@latestnpm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.npm warn deprecated node-domexception@1.0.0: Use your platform's native DOMException instead...npm warn deprecated tar@6.2.1: Old versions of tar are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me...npm warn deprecated tar@6.2.1: Old versions of tar are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.meadded 701 packages in 28m128 packages are looking for funding run `npm fund` for details三、配置OpenClaw并启动服务