OpenClaw 安装/更新内存不足问题解决方案

3 阅读1分钟

问题

系统内存(RAM)不足导致安装失败,错误信息中的 "Killed" 表明 Linux 内核的 OOM Killer 终止了进程。

错误日志

main: line 141: 2066 Killed npm ... install ...

执行 npm install 时内存耗尽。

解决方案

1. 释放内存后重试

关闭不必要的应用程序,重新运行安装命令:

curl -fsSL <https://openclaw.ai/install.sh> | bash

2. 增加交换空间

sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
# 重新运行安装命令
# 安装成功后移除:
sudo swapoff /swapfile && sudo rm /swapfile

3. 跳过可选依赖

git clone <https://github.com/openclaw-ai/openclaw.git>
cd openclaw
npm install --no-optional

4. 检查系统状态

free -h                    # 查看内存
dmesg | tail -30 | grep -i kill  # 查看 OOM 日志

通常第一步或第二步就能解决问题。