跳转到主要内容

Documentation Index

Fetch the complete documentation index at: https://docs.openclaw.ai/llms.txt

Use this file to discover all available pages before exploring further.

让 OpenClaw 保持最新。

推荐:openclaw update

最快的更新方式。它会检测你的安装类型(npm 或 git)、获取最新版本、运行 openclaw doctor,并重启 Gateway 网关。
openclaw update
要切换渠道或指定特定版本:
openclaw update --channel beta
openclaw update --channel dev
openclaw update --tag main
openclaw update --dry-run   # preview without applying
openclaw update 不接受 --verbose。对于更新诊断,请使用 --dry-run 预览计划执行的操作,使用 --json 获取结构化结果,或使用 openclaw update status --json 检查渠道和可用性状态。安装器有自己的 --verbose 标志,但该标志不属于 openclaw update --channel beta 优先使用 beta,但当 beta tag 缺失或早于最新 stable 发布时, 运行时会回退到 stable/latest。如果你想为一次性软件包更新使用原始 npm beta dist-tag, 请使用 --tag beta 有关渠道语义,请参阅开发渠道

在 npm 和 git 安装之间切换

当你想更改安装类型时,请使用渠道。更新器会保留你的 状态、配置、凭证和 ~/.openclaw 中的工作区;它只会更改 CLI 和 Gateway 网关使用的 OpenClaw 代码安装。
# npm package install -> editable git checkout
openclaw update --channel dev

# git checkout -> npm package install
openclaw update --channel stable
先使用 --dry-run 运行,以预览确切的安装模式切换:
openclaw update --channel dev --dry-run
openclaw update --channel stable --dry-run
dev 渠道会确保存在一个 git checkout,构建它,并从该 checkout 安装全局 CLI。 stablebeta 渠道使用软件包安装。如果 Gateway 网关已经安装, openclaw update 会刷新服务元数据并重启它,除非你传入 --no-restart

替代方式:重新运行安装器

curl -fsSL https://openclaw.ai/install.sh | bash
添加 --no-onboard 可跳过新手引导。要通过安装器强制使用特定安装类型, 请传入 --install-method git --no-onboard--install-method npm --no-onboard 如果 openclaw update 在 npm 软件包安装阶段之后失败,请重新运行 安装器。安装器不会调用旧的更新器;它会直接运行全局 软件包安装,并且可以恢复部分更新的 npm 安装。
curl -fsSL https://openclaw.ai/install.sh | bash -s -- --install-method npm
要将恢复固定到特定版本或 dist-tag,请添加 --version
curl -fsSL https://openclaw.ai/install.sh | bash -s -- --install-method npm --version <version-or-dist-tag>

替代方式:手动使用 npm、pnpm 或 bun

npm i -g openclaw@latest
对于受管理的安装,优先使用 openclaw update,因为它可以协调 软件包切换和正在运行的 Gateway 服务。如果在受管理的 Gateway 正在运行时手动更新, 请在包管理器完成后立即重启 Gateway 网关,避免旧进程继续从已替换的软件包文件提供服务。 openclaw update 管理全局 npm 安装时,它会先将目标安装到 临时 npm prefix,验证打包的 dist inventory,然后将干净的软件包树切换到真实的全局 prefix。 这可以避免 npm 将新软件包叠加到旧软件包留下的陈旧文件之上。如果安装命令失败, OpenClaw 会使用 --omit=optional 重试一次。该重试有助于原生可选依赖无法编译的主机, 同时如果回退也失败,仍会保留原始失败信息的可见性。
pnpm add -g openclaw@latest
bun add -g openclaw@latest

高级 npm 安装主题

OpenClaw 在运行时会将打包的全局安装视为只读,即使当前用户可写全局软件包目录也是如此。插件软件包安装位于用户配置目录下由 OpenClaw 拥有的 npm/git 根目录中,Gateway 网关启动不会修改 OpenClaw 软件包树。一些 Linux npm 设置会将全局软件包安装在 root 拥有的目录下,例如 /usr/lib/node_modules/openclaw。OpenClaw 支持这种布局,因为插件安装/更新命令会写入该全局软件包目录之外的位置。
授予 OpenClaw 对其配置/状态根目录的写入权限,以便显式插件安装、插件更新和 Doctor 清理可以持久化其更改:
ReadWritePaths=/var/lib/openclaw /home/openclaw/.openclaw /tmp
在软件包更新和显式插件安装之前,OpenClaw 会尽力检查目标卷的磁盘空间。空间不足会产生包含已检查路径的警告,但不会阻止更新,因为文件系统配额、快照和网络卷可能在检查后发生变化。实际的包管理器安装和安装后验证仍然是权威结果。

自动更新器

自动更新器默认关闭。在 ~/.openclaw/openclaw.json 中启用它:
{
  update: {
    channel: "stable",
    auto: {
      enabled: true,
      stableDelayHours: 6,
      stableJitterHours: 12,
      betaCheckIntervalHours: 1,
    },
  },
}
渠道行为
stable等待 stableDelayHours,然后在 stableJitterHours 范围内以确定性抖动应用(分散推出)。
beta每隔 betaCheckIntervalHours 检查一次(默认:每小时),并立即应用。
dev不自动应用。请手动使用 openclaw update
Gateway 网关也会在启动时记录更新提示(可用 update.checkOnStart: false 禁用)。 对于降级或事故恢复,请在 Gateway 网关环境中设置 OPENCLAW_NO_AUTO_UPDATE=1,即使配置了 update.auto.enabled 也会阻止自动应用。启动更新提示仍可运行,除非也禁用了 update.checkOnStart 通过实时 Gateway 控制平面处理程序请求的包管理器更新会在软件包切换后 强制执行非延迟、无冷却时间的更新重启。这可以避免旧的内存中进程停留过久, 从已经被替换的软件包树中 lazy-load chunk。对于受管理的安装,shell openclaw update 仍是首选路径,因为它可以在更新期间停止并重启服务。

更新后

1
运行 Doctor
2
openclaw doctor
3
迁移配置、审计私信策略,并检查 Gateway 网关健康状态。详情:Doctor
4
重启 Gateway 网关
5
openclaw gateway restart
6
验证
7
openclaw health

回滚

固定版本(npm)

npm i -g openclaw@<version>
openclaw doctor
openclaw gateway restart
npm view openclaw version 会显示当前已发布版本。

固定 commit(源码)

git fetch origin
git checkout "$(git rev-list -n 1 --before=\"2026-01-01\" origin/main)"
pnpm install && pnpm build
openclaw gateway restart
要返回最新版本:git checkout main && git pull

如果你遇到问题

  • 再次运行 openclaw doctor,并仔细阅读输出。
  • 对于源码 checkout 上的 openclaw update --channel dev,更新器会在需要时自动 bootstrap pnpm。如果你看到 pnpm/corepack bootstrap 错误,请手动安装 pnpm(或重新启用 corepack),然后重新运行更新。
  • 查看:故障排除
  • 在 Discord 中提问:https://discord.gg/clawd

相关内容