11---
22read_when :
3- - 更新 OpenClaw 时
3+ - 更新 OpenClaw
44 - 更新后出现问题
55summary : 安全更新 OpenClaw(全局安装或源码安装),以及回滚策略
66title : 更新
77x-i18n :
8- generated_at : " 2026-04-06T00:47:09Z "
8+ generated_at : " 2026-04-22T04:04:23Z "
99 model : gpt-5.4
1010 provider : openai
11- source_hash : ca9fff0776b9f5977988b649e58a5d169e5fa3539261cb02779d724d4ca92877
11+ source_hash : 6ab2b515457c64d24c830e2e1678d9fefdcf893e0489f0d99b039db3b877b3c4
1212 source_path : install/updating.md
1313 workflow : 15
1414---
@@ -30,22 +30,22 @@ openclaw update
3030``` bash
3131openclaw update --channel beta
3232openclaw update --tag main
33- openclaw update --dry-run # 预览但不实际应用
33+ openclaw update --dry-run # 仅预览,不实际应用
3434```
3535
36- ` --channel beta ` 会优先选择 beta,但当 beta 标签不存在或版本比最新稳定版更旧时 ,运行时会回退到 stable/latest。如果你想为一次性的软件包更新使用原始 npm beta dist-tag,请使用 ` --tag beta ` 。
36+ ` --channel beta ` 会优先选择 beta,但当 beta 标签不存在或版本落后于最新稳定版时 ,运行时会回退到 stable/latest。如果你想在一次性包更新中使用原始 npm beta dist-tag,请使用 ` --tag beta ` 。
3737
38- 有关渠道语义,请参阅 [ 开发渠道] ( /zh-CN/install/development-channels ) 。
38+ 有关渠道语义,请参见 [ 开发渠道] ( /zh-CN/install/development-channels ) 。
3939
40- ## 另一种方式:重新运行安装程序
40+ ## 备选方案:重新运行安装脚本
4141
4242``` bash
4343curl -fsSL https://openclaw.ai/install.sh | bash
4444```
4545
4646添加 ` --no-onboard ` 可跳过新手引导。对于源码安装,请传入 ` --install-method git --no-onboard ` 。
4747
48- ## 另一种方式 :手动使用 npm、pnpm 或 bun
48+ ## 备选方案 :手动使用 npm、pnpm 或 bun
4949
5050``` bash
5151npm i -g openclaw@latest
@@ -59,9 +59,22 @@ pnpm add -g openclaw@latest
5959bun add -g openclaw@latest
6060```
6161
62+ ### 由 root 拥有的全局 npm 安装
63+
64+ 某些 Linux 的 npm 配置会将全局包安装到由 root 拥有的目录中,例如 ` /usr/lib/node_modules/openclaw ` 。OpenClaw 支持这种布局:安装后的包在运行时会被视为只读,内置插件的运行时依赖会被暂存到一个可写的运行时目录中,而不是直接修改包目录树。
65+
66+ 对于强化过的 systemd 单元,请设置一个可写的暂存目录,并将其包含在 ` ReadWritePaths ` 中:
67+
68+ ``` ini
69+ Environment =OPENCLAW_PLUGIN_STAGE_DIR =/var/lib/openclaw/plugin-runtime-deps
70+ ReadWritePaths =/var/lib/openclaw /home/openclaw/.openclaw /tmp
71+ ```
72+
73+ 如果未设置 ` OPENCLAW_PLUGIN_STAGE_DIR ` ,OpenClaw 会在 systemd 提供时使用 ` $STATE_DIRECTORY ` ,否则回退到 ` ~/.openclaw/plugin-runtime-deps ` 。
74+
6275## 自动更新器
6376
64- 自动更新器默认关闭。可在 ` ~/.openclaw/openclaw.json ` 中启用 :
77+ 自动更新器默认关闭。在 ` ~/.openclaw/openclaw.json ` 中启用它 :
6578
6679``` json5
6780{
@@ -77,13 +90,13 @@ bun add -g openclaw@latest
7790}
7891```
7992
80- | 渠道 | 行为 |
81- | -------- | ------------------------------------------------------------------------------------------------------------- |
82- | ` stable ` | 等待 ` stableDelayHours ` 后,在 ` stableJitterHours ` 范围内以确定性抖动方式应用(分散发布) 。 |
93+ | Channel | 行为 |
94+ | -------- | ---- |
95+ | ` stable ` | 等待 ` stableDelayHours ` 后应用,并在 ` stableJitterHours ` 范围内使用确定性抖动分散发布 。 |
8396| ` beta ` | 每隔 ` betaCheckIntervalHours ` 检查一次(默认:每小时),并立即应用。 |
8497| ` dev ` | 不会自动应用。请手动使用 ` openclaw update ` 。 |
8598
86- Gateway 网关也会在启动时记录更新提示 (可通过 ` update.checkOnStart: false ` 禁用)。
99+ Gateway 网关还会在启动时记录更新提示 (可通过 ` update.checkOnStart: false ` 禁用)。
87100
88101## 更新后
89102
@@ -95,7 +108,7 @@ Gateway 网关也会在启动时记录更新提示(可通过 `update.checkOnSt
95108openclaw doctor
96109```
97110
98- 迁移配置、审计私信策略,并检查 Gateway 网关健康状态。详情请参阅: [ Doctor] ( /zh-CN/gateway/doctor )
111+ 迁移配置、审计私信策略,并检查 Gateway 网关健康状态。详情: [ Doctor] ( /zh-CN/gateway/doctor )
99112
100113### 重启 Gateway 网关
101114
@@ -113,7 +126,7 @@ openclaw health
113126
114127## 回滚
115128
116- ### 固定版本 (npm)
129+ ### 固定到某个版本 (npm)
117130
118131``` bash
119132npm i -g openclaw@< version>
@@ -123,7 +136,7 @@ openclaw gateway restart
123136
124137提示:` npm view openclaw version ` 会显示当前已发布的版本。
125138
126- ### 固定提交 (源码)
139+ ### 固定到某个提交 (源码)
127140
128141``` bash
129142git fetch origin
@@ -132,17 +145,17 @@ pnpm install && pnpm build
132145openclaw gateway restart
133146```
134147
135- 返回最新版本 :` git checkout main && git pull ` 。
148+ 要恢复到最新版本 :` git checkout main && git pull ` 。
136149
137150## 如果你卡住了
138151
139152- 再次运行 ` openclaw doctor ` ,并仔细阅读输出内容。
140- - 对于源码检出的 ` openclaw update --channel dev ` ,更新器会在需要时自动引导安装 ` pnpm ` 。如果你看到 pnpm/corepack 引导错误,请手动安装 ` pnpm ` (或重新启用 ` corepack ` ),然后重新运行更新。
153+ - 对于源码检出中的 ` openclaw update --channel dev ` ,更新器会在需要时自动引导安装 ` pnpm ` 。如果你看到 pnpm/corepack 引导错误,请手动安装 ` pnpm ` (或重新启用 ` corepack ` ),然后重新运行更新。
141154- 查看:[ 故障排除] ( /zh-CN/gateway/troubleshooting )
142- - 在 Discord 中提问 :[ https://discord.gg/clawd ] ( https://discord.gg/clawd )
155+ - 在 Discord 提问 :[ https://discord.gg/clawd ] ( https://discord.gg/clawd )
143156
144157## 相关内容
145158
146- - [ 安装概览] ( /zh-CN/install ) — 所有安装方式
147- - [ Doctor] ( /zh-CN/gateway/doctor ) — 更新后的健康检查
148- - [ 迁移] ( /zh-CN/install/migrating ) — 主版本迁移指南
159+ - [ 安装概览] ( /zh-CN/install ) —— 所有安装方式
160+ - [ Doctor] ( /zh-CN/gateway/doctor ) —— 更新后的健康检查
161+ - [ 迁移] ( /zh-CN/install/migrating ) —— 主要版本迁移指南
0 commit comments