opencode update/upgrade times out behind corporate npm mirror: installer hard-codes registry.npmjs.org and ignores configured registry
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 68/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- bash, typescript
调研方向
阅读 install 中的 curl 安装程序,重点检查第 195、199 和 212 行的 registry URL,并查看它如何接收 npm 配置。配置一个 registry 镜像并复现问题,确认安装程序在可用性检查和 tarball 下载时都会使用该镜像。完成标准是更新路径可以使用已配置的 registry,并在未配置时仍回退到 npmjs。
由索引模型根据 Issue 内容生成。
描述
Description
opencode update (and the opencode upgrade step it shells out to) times out on networks where registry.npmjs.org is unreachable, even though the machine has a fully working corporate npm mirror (JFrog Artifactory) configured in ~/.npmrc.
Root cause: the curl installer script hard-codes https://registry.npmjs.org in three places, ignoring the configured npm registry:
installline 195 — version availability check:https://registry.npmjs.org/$package_scope%2fcli-$target/$specific_versioninstallline 199 — legacy package name fallback, same hard-coded hostinstallline 212 — tarball download:url="https://registry.npmjs.org/$package_name/-/$filename"
On my network registry.npmjs.org connections hang until timeout (the corporate egress proxy never completes the TLS handshake to that host), so both the availability check and the tarball download fail. opencode update reports only "Timed out" with no indication of which URL/host failed, and no way to point it at the internal mirror.
Evidence from this network:
$ curl -s -o /dev/null -w "%{http_code} %{time_total}s\n" https://registry.npmjs.org/@opencode%2fcli-linux-x64/2.2.5
HTTP 000 / connection hangs (killed after 15 s)
$ curl -s -o /dev/null -w "%{http_code} %{time_total}s\n" https://api.github.com/ # control
HTTP 200 0.55 s
The internal mirror serves the exact same package and tarball (same path shape, same checksums):
$ curl -s -o /dev/null -w "%{http_code} %{time_total}s\n" \
https://<internal-artifactory>/api/npm/npm-group-all/@opencode%2fcli-linux-x64/2.2.5
HTTP 200 2.2 s
Workaround I used: download the GitHub release tarball manually and install it with install --binary, which correctly skips the npm download path.
This is the installer-side instance of the registry problem tracked in #57797 (which covers the Desktop SSH bootstrap). Suggested fix, same as proposed there: respect NPM_CONFIG_REGISTRY / npm_config_registry (and ideally ~/.npmrc registry=) with fallback to https://registry.npmjs.org:
registry="${NPM_CONFIG_REGISTRY:-${npm_config_registry:-https://registry.npmjs.org/}}"
registry="${registry%/}"
then use $registry in place of the three hard-coded URLs. Additionally, failing fast with a clear error naming the unreachable host (instead of a generic "Timed out") would make this class of problem diagnosable.
Steps to reproduce
- Be on a network where
registry.npmjs.orgis unreachable (direct or via corporate egress proxy that cannot reach it), with a working npm mirror set in~/.npmrc. - Run
opencode updatewith any version prior to the target. - The
opencode upgrade --method curlstep shells out to the install script, which hangs onregistry.npmjs.organd is killed by the updater's timeout.
┌ Upgrade
│ ● Using method: curl
│ ● From 2.0.18 → 2.2.5
│ ■ Upgrade failed
│ ■ The OpenCode installer failed
│ │ Timed out
│ │ Command opencode upgrade 2.2.5 --method curl
└ Failed
OpenCode version
2.0.18 → 2.2.5 (upgrade attempt); affected installer script served at https://opencode.ai/v2/install
Operating System
RHEL 8 x86_64 (linux-x64)
Terminal
bash
- 主要语言
- TypeScript
- 星标
- 224k
- 派生
- 30k
- 平均合并
- 4 小时 44 分钟
- 30 天内合并 PR
- 513
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
anomalyco/opencode 的其他 Issue
-
pending close triaging
难度 2/5 1-3 小时 新手友好度 78/100
anomalyco/opencode#62582 · 1 条评论 ·
维护者通常 1 天内回复
-
reproduced
难度 2/5 1-3 小时 新手友好度 72/100
anomalyco/opencode#62516 · 2 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
anomalyco/opencode#62374 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
anomalyco/opencode#62362 · 1 条评论 ·
维护者通常 1 天内回复
-
reproduced
难度 2/5 1-3 小时 新手友好度 63/100
anomalyco/opencode#62343 · 1 条评论 ·
维护者通常 1 天内回复
查看 anomalyco/opencode 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
-
feature request
难度 2/5 1-3 小时 新手友好度 72/100
callstack/react-native-paper#5189 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
live-codes/livecodes#1079 · 1 条评论 ·
维护者通常 1 天内回复
-
Add: ESP 2 RO未关闭approved check:passed streams:add
难度 2/5 1-3 小时 新手友好度 66/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复