目录
- 一、直接升级失败
- 二、升级前备份(可选)
- 三、按提示升级相关组件
- 1. 安装NodeSource仓库
- 2. 安装 Node.js(会自动覆盖旧版本)
- 3. 验证版本
- 4. 重新升级 OpenClaw
- 5.重新验证版本
- 6.更新插件(容易忘记)
- 7.Doctor 检查
- 8.重启网关
- 9.拓展:为什么使用NodeSource仓库升级?
- 1. Ubuntu官方仓库的版本比较旧
- 2. NodeSource是 Node.js官方维护的独立仓库
一、直接升级失败
之前的版本是2026.5.7 (eeef486),有段时间没有升级了,于是,想着按常规操作,直接进行升级,结果失败了。
root@lavm-rh3z5lsj1q:~# npm install -g openclaw@latestnpmwarn EBADENGINE Unsupported engine{npmwarn EBADENGINE package:'openclaw@2026.7.1-2',npmwarn EBADENGINE required:{node:'>=22.22.3 <23 || >=24.15.0 <25 || >=25.9.0'},npmwarn EBADENGINE current:{node:'v22.22.2', npm:'10.9.7'}npmwarn EBADENGINE}added15packages, removed265packages, and changed285packagesin2m67packages are lookingforfunding run`npmfund`fordetails二、升级前备份(可选)
cp-r/root/.openclaw/ /root/.openclaw-backup/三、按提示升级相关组件
1. 安装NodeSource仓库
curl-fsSLhttps://deb.nodesource.com/setup_24.x|sudo-Ebash-2. 安装 Node.js(会自动覆盖旧版本)
sudoapt-getinstall-ynodejs3. 验证版本
node-v# 应显示 v24.x.x如下:
root@lavm-rh3z5lsj1q:~# node -vv24.18.14. 重新升级 OpenClaw
npminstall-gopenclaw@latest5.重新验证版本
openclaw--version可以看到openclaw版本已经升级完成:
root@lavm-rh3z5lsj1q:~# openclaw -vOpenClaw2026.7.1-2(0790d9f)6.更新插件(容易忘记)
openclaw plugins update--all更新插件以保证相应插件在新版本上还能正常使用:
root@lavm-rh3z5lsj1q:~# openclaw plugins update --all│ ◇ Installing @openclaw/feishu into /root/.openclaw/npm/projects/openclaw-feishu-dc69f44688… Linked peerDependency"openclaw"->/usr/lib/node_modules/openclaw Updated feishu:2026.5.7 ->2026.7.1. qwen is up todate(2026.7.1). zai is up todate(2026.7.1). Restart the gateway to load plugins and hooks.7.Doctor 检查
openclaw doctor--fix健康检查过程中,可以看到,版本升级后,自动进行了qwen 的 API 密钥迁移(如果没有做此动作,大模型的对话功能将不可用,模型调用会全部失败:
... ◇ Auth profile SQLite migration ──────────────────────────────────────────────────────╮ │ │ │ - ~/.openclaw/agents/main/agent/auth-profiles.json / │ │ ~/.openclaw/agents/main/agent/auth-state.json │ │ - openclaw doctor--fiximports legacy auth profile JSON into the per-agent SQLite │ │ database and removes the old files after backup. │ │ │ ├──────────────────────────────────────────────────────────────────────────────────────╯...另外,列出一些自己感觉需要处理的提示:
... ◇ Command owner ────────────────────────────────────────────────────────────────────────────╮ │ │ │ Nocommandowner is configured. │ │ Acommandowner is the human operator account allowed to run owner-only commands and │ │ approve dangerous actions, including /diagnostics, /export-trajectory, /config, andexec│ │ approvals. │ │ DM pairing only lets someone talk to the bot;it does notmakethat sender the ownerfor│ │ privileged commands. │ │ Fix:setcommands.ownerAllowFrom to your channel user id,forexample openclaw config │ │setcommands.ownerAllowFrom'["telegram:123456789"]'│ │ Restart the gateway after changing thisifit is already running. │ │ │ ├────────────────────────────────────────────────────────────────────────────────────────────╯ │ ◇ Plugin registry ───────────────────────────────────────────╮ │ │ │ Plugin registry refreshed:52/70 enabled plugins indexed. │ │ │ ├─────────────────────────────────────────────────────────────╯ │ ◆ Archive18orphan transcript filesin~/.openclaw/agents/main/sessions? This only renames them to *.deleted.<timestamp>. │ ● Yes / ○ No说明:
系统发现 ~/.openclaw/agents/main/sessions 目录下有 18 个孤立的会话转录文件,问我们是否要归档(只是重命名为 *.deleted.<时间戳>,不会真正删除)。
建议选 Yes,这些是旧版本遗留的孤儿文件,归档后不会影响任何功能,能让目录更整洁。
其它相关提示也类似,我们按需按提示进行操作即可。
8.重启网关
这套组合拳适用于任何用 systemd 管理的用户服务(OpenClaw、Docker、Nginx 等)
# 1. 改了配置 → 让 systemd 重新加载systemctl--userdaemon-reload# 2. 重启服务systemctl--userrestart openclaw-gateway.service# 3. 确认状态systemctl--userstatus openclaw-gateway.service# (可选)如果 status 还是 failed,前台启动看详细报错# openclaw gateway run附:
openclaw gateway run(直接在终端前台启动 gateway)
和 systemctl restart 的区别:
| 方式 | 运行环境 | 适用场景 | 退出后 |
|---|---|---|---|
systemctl --user restart ... | 后台(systemd 托管) | 正式运行 | 自动重启 |
openclaw gateway run | 前台(当前终端) | 调试排错 | 服务停止 |
至此,升级完成,网关重启后即可恢复正常使用。
9.拓展:为什么使用NodeSource仓库升级?
1. Ubuntu官方仓库的版本比较旧
Ubuntu 为了保证系统稳定性,官方仓库里的 Node.js 版本通常是
frozen(冻结)的:
- Ubuntu 22.04 官方源:Node.js v12
- Ubuntu 24.04 官方源:Node.js v18
这意味着:
sudoaptinstallnodejs# 可能装的是 v12 或 v18,远落后于当前需求sudoaptupgrade nodejs# 只能升到 Ubuntu 官方维护的最新补丁,大版本不会变2. NodeSource是 Node.js官方维护的独立仓库
NodeSource 是 Node.js 官方团队直接维护的 Debian/Ubuntu 包仓库,特点:
| 维度 | Ubuntu 官方源 | NodeSource 仓库 |
|---|---|---|
| 版本 | 冻结在发布时的版本 | 提供 Node 18/20/22/24 等所有活跃版本 |
| 更新频率 | 仅安全补丁 | 跟随 Node.js 官方发布节奏 |
| 包来源 | Ubuntu 维护者打包 | Node.js 官方团队直接打包 |
| 与系统冲突 | 可能与其他系统包耦合 | 独立安装,不依赖系统其他组件 |