Skip to content

fix(update): install from the official npm registry to match version detection - #333

Merged
gujieye merged 1 commit into
mainfrom
fix/update-registry-mismatch
Nov 23, 2026
Merged

gujieye merged 1 commit into
mainfrom
fix/update-registry-mismatch

Conversation

@gujieye

@gujieye gujieye commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator

Summary

bl update 检测版本与安装版本走了不同的 npm 源:检测固定查询官方源 registry.npmjs.org,而 npm install -g bailian-cli@latest 使用用户 ~/.npmrc 配置的 registry(如阿里内网镜像)。镜像同步滞后时,npm 会静默重装当前版本,更新后提示 2.10.4 → 2.10.4(谎报成功)。

修复:两条 npm 安装路径(bl update 与自动更新 performAutoUpdate)统一追加 --registry=https://registry.npmjs.org,与检测同源;--to 固定版本路径同样生效。

Changes

  • packages/commands/src/commands/update.ts:npm 安装命令追加 --registry=${NPM_REGISTRY}
  • packages/runtime/src/utils/update-checker.ts:performAutoUpdate 同样追加
  • 两处对应测试断言同步更新

Evidence

实测(2026-11-23,2.10.5 发布于 05:41Z):

  • 官方源:latest = 2.10.5,版本列表含 2.10.5
  • 用户内网镜像 registry.anpm.alibaba-inc.com:latest = 2.10.4,无 2.10.5(空缓存复现,排除本地缓存)
  • 根因:检测/安装不同源,镜像滞后窗口内更新静默失效

Test plan

  • vp test packages/runtime/tests/update-checker.test.ts packages/commands/tests/update-binary-skill-sync.test.ts:28 passed,1.64s
  • vp check:0 errors(2 warnings 为 tools/release 存量,与本次无关)
  • 真实 bl update 端到端:需等待包含本修复的版本发布后验证

…detection

Version detection queries registry.npmjs.org, but npm install ran against the
user-configured registry (e.g. the Alibaba internal mirror). When the mirror
lags behind a publish, npm silently reinstalled the current version and the
update reported "X → X" as success. Install with --registry=<official> in both
bl update and auto-update so the two steps use the same source.
@gujieye
gujieye merged commit a382549 into main Nov 23, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant