openclaw - 💡(How to fix) Fix Control UI frontend bundle not updated in npm publish (shows stale version)

Official PRs (…)
ON THIS PAGE

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Code Example

npm install -g openclaw@latest
   # 或指定版本: npm install -g openclaw@2026.5.19-beta.1

---

openclaw gateway run

---

http://localhost:18789/
RAW_BUFFERClick to expand / collapse

Control UI 前端版本号错误 — npm 包内 bundle 未随版本更新

问题描述

升级 OpenClaw 到最新版后,Control UI 页面显示的版本号仍然停留在 v2026.5.7,且前端 JS bundle 的 hash 也未改变(index-NYVkUQrq.js),导致无法使用新版本 Control UI 的新功能。

复现步骤

  1. 安装最新版 OpenClaw:

    npm install -g openclaw@latest
    # 或指定版本: npm install -g [email protected]
  2. 启动 Gateway:

    openclaw gateway run
  3. 打开 Control UI:

    http://localhost:18789/
  4. 实际结果:

    • 页面底部显示 "Running v2026.5.7"
    • CLI 版本是 2026.5.19-beta.1
    • openclaw --version 输出也是 2026.5.19-beta.1

实际表现

组件版本
openclaw --version (CLI)2026.5.19-beta.1
Gateway runtime 版本2026.5.19-beta.1
Control UI 页面显示v2026.5.7
前端 JS bundle hashindex-NYVkUQrq.js (旧的)
磁盘上 dist/control-ui/index.html 引用index-B9aIykxh.js (新的)

调查发现

  1. Gateway 返回的 HTML 来自嵌入式副本,不是 dist/control-ui/index.html

    • dist/control-ui/index.html 在磁盘上已更新(9803 字节,引用 index-B9aIykxh.js、含 mount-fallback 功能)
    • Gateway 返回的 HTML 不同(2821 字节,引用 index-NYVkUQrq.js、无 mount-fallback)
  2. 旧 bundle 不存在于磁盘

    • index-NYVkUQrq.js(1MB)在 /usr/local/lib/node_modules/openclaw/dist/ 中无法找到
    • 但 Gateway 返回 200 → 说明被编译嵌入了运行时二进制
  3. npm 更新未重编 Gateway 二进制

    • npm install -g [email protected] 更新了 dist/control-ui/ 目录的文件
    • 但 Gateway 的运行时代码(dist/entry.js 及其导入链)仍然使用旧的编译时嵌入的 HTML/JS
  4. 重启容器也无法解决

    • Docker 镜像构建时嵌入的是旧 bundle,重启只是重新加载同样的代码

根源分析

OpenClaw 的构建管线(rolldown/tsdown)将 Control UI 的 HTML 模板和默认 JS bundle 直接编译进了 Gateway 的运行时二进制中。当 npm publish 时,如果 UI 的 Vite 构建产物更新了,但 Gateway 源代码的对应字符串/引用没有同步更新,就会导致发布的新版本包里:

  • dist/control-ui/ 目录 ✅ 新版本的 UI 文件
  • Gateway 运行时 ❌ 旧的嵌入 HTML/JS

建议修复方向

方案 A(推荐):Gateway 运行时从 dist/control-ui/ 读取 UI 文件

修改 Gateway HTTP 服务器代码,使其为 Control UI 路由(/)直接服务 dist/control-ui/index.htmldist/control-ui/assets/ 中的静态文件,而不是使用编译时嵌入的副本。这样 npm 包更新后,重新启动 Gateway 即可加载最新的 UI。

方案 B:构建时检查 UI 版本一致性

npm publish 之前或构建过程中增加检查:验证控制 UI 的 dist/control-ui/index.html 引用的 JS bundle hash 与 Gateway 运行时编译的 HTML 模板中的 hash 一致。

环境信息

  • OpenClaw 版本: 2026.5.19-beta.1 (ba9034b)
  • Node.js: 22+
  • OS: Docker (Debian slim)
  • 安装方式: npm install -g [email protected]

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix Control UI frontend bundle not updated in npm publish (shows stale version)