Files
Obsidian/博客/编程与工具/OpenClaw安装教程.md
T

118 lines
2.4 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# OpenClaw Windows 安装教程
## 教学链接
[OpenClaw安装教程文字版 - 飞书云文档](https://ncnlkzxypt73.feishu.cn/wiki/Qch4wpBA6iNaSikkYSGcpfn7nRh?renamingWikiNode=false)
[视频版](https://www.bilibili.com/video/BV1UsP1zqEWc)
## 系统要求
- **Node.js 24**(推荐)或 Node.js 22.16+
- **Windows 10/11**(原生 Windows 或 WSL2 均支持)
- 建议使用 WSL2,体验更稳定
## 安装方法
### 方法一:官方安装脚本(推荐)
**PowerShell** 中运行:
```powershell
iwr -useb https://openclaw.ai/install.ps1 | iex
```
如果不需要运行初始配置:
```powershell
& ([scriptblock]::Create((iwr -useb https://openclaw.ai/install.ps1))) -NoOnboard
```
### 方法二:使用 npm
如果你已经安装了 Node.js
```bash
npm install -g openclaw@latest
openclaw onboard --install-daemon
```
### 方法三:使用 pnpm
```bash
pnpm add -g openclaw@latest
pnpm approve-builds -g
openclaw onboard --install-daemon
```
> ⚠️ pnpm 需要对带构建脚本的包进行明确授权,首次安装后记得运行 `pnpm approve-builds -g`
## 安装后验证
安装完成后,在终端中运行以下命令验证:
```bash
openclaw --version # 确认 CLI 可用
openclaw doctor # 检查配置问题
openclaw gateway status # 验证 Gateway 是否运行
```
## 常见问题
### "openclaw" 命令找不到
如果安装成功但终端找不到命令:
1. 检查 Node.js 是否安装:
```bash
node -v
```
2. 检查全局包安装路径:
```bash
npm prefix -g
```
3. 检查 PATH 环境变量是否包含全局 bin 目录
4. 如果没有,添加以下到 PowerShell 配置文件:
```powershell
$env:PATH = "$env:PATH;$(npm prefix -g)\bin"
```
### sharp 构建错误
如果 `sharp` 因全局安装的 libvips 失败:
```bash
SHARP_IGNORE_GLOBAL_LIBVIPS=1 npm install -g openclaw@latest
```
## 启动使用
首次启动会进入配置向导:
```bash
openclaw onboard
```
按照屏幕提示完成:
1. 选择 AI 模型
2. 配置消息通道(QQ、微信、飞书等)
3. 设置管理员
## 卸载
如果需要卸载:
```bash
openclaw uninstall
```
或者手动删除:
- `%APPDATA%\openclaw` 目录
- 全局 npm 包:`npm uninstall -g openclaw`