今天升级到codex 0.134.0之后运行报错:
shell
$ codex
file:///home/simon/.npm-global/lib/node_modules/@openai/codex/bin/codex.js:122
throw new Error(
^
Error: Missing optional dependency @openai/codex-linux-arm64. Reinstall Codex: npm install -g @openai/codex@latest
at file:///home/simon/.npm-global/lib/node_modules/@openai/codex/bin/codex.js:122:9
at ModuleJob.run (node:internal/modules/esm/module_job:430:25)
at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:661:26)
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:101:5)
Node.js v24.14.0
按照提示重装还是在安装过程中报错:
shell
# 先卸载并清除缓存
npm uninstall -g @openai/codex
npm cache clean --force
重装报错信息:
shell
npm install -g @openai/codex@latest --verbose --registry=https://registry.npmjs.org/
npm verbose cli /usr/local/bin/node /usr/local/bin/npm
npm info using npm@11.9.0
npm info using node@v24.14.0
npm verbose title npm install @openai/codex@latest
npm verbose argv "install" "--global" "@openai/codex@latest" "--loglevel" "verbose" "--registry" "https://registry.npmjs.org/"
npm verbose logfile logs-max:10 dir:/home/simon/.npm/_logs/2026-05-27T19_20_16_786Z-
npm verbose logfile /home/simon/.npm/_logs/2026-05-27T19_20_16_786Z-debug-0.log
npm http fetch GET 200 https://registry.npmjs.org/@openai%2fcodex 1409ms (cache miss)
npm http cache https://registry.npmjs.org/@openai%2fcodex 135ms (cache hit)
npm http cache https://registry.npmjs.org/@openai%2fcodex 164ms (cache hit)
npm http cache https://registry.npmjs.org/@openai%2fcodex 585ms (cache hit)
npm http cache https://registry.npmjs.org/@openai%2fcodex 874ms (cache hit)
npm http cache https://registry.npmjs.org/@openai%2fcodex 546ms (cache hit)
npm http cache https://registry.npmjs.org/@openai%2fcodex 430ms (cache hit)
npm http cache https://registry.npmjs.org/@openai%2fcodex 1586ms (cache hit)
npm http cache @openai/codex@https://registry.npmjs.org/@openai/codex/-/codex-0.134.0.tgz 0ms (cache hit)
npm http cache @openai/codex-linux-arm64@https://registry.npmjs.org/@openai/codex/-/codex-0.134.0-linux-arm64.tgz 0ms (cache hit)
npm verbose reify failed optional dependency /home/simon/.npm-global/lib/node_modules/@openai/codex/node_modules/@openai/codex-linux-arm64
changed 1 package in 7s
npm verbose cwd /home/simon/mimusic
npm verbose os Linux 6.12.11-edge-sunxi64
npm verbose node v24.14.0
npm verbose npm v11.9.0
npm verbose exit 0
npm info ok
看提示就是下载主程序包失败,反复尝试不同版本多次依然不行。
然后使用wget单独下载此文件看到了如下信息:
shell
wget -O codex-linux-arm64.tgz \
https://registry.npmjs.org/@openai/codex/-/codex-0.134.0-linux-arm64.tgz
--2026-05-28 03:27:42-- https://registry.npmjs.org/@openai/codex/-/codex-0.134.0-linux-arm64.tgz
正在连接 192.168.123.32:7892... 已连接。
已发出 Proxy 请求,正在等待回应... 200 OK
长度:83530982 (80M) [application/octet-stream]
正在保存至: "codex-linux-arm64.tgz"
codex-linux-arm64.tgz 6%[===> ] 4.86M 5.26MB/s 用时 0.9s
2026-05-28 03:27:44 (5.26 MB/s) - 在 5098688/83530982 字节处发生读取错误 (Error decoding the received TLS packet.)。重试中。
--2026-05-28 03:27:45-- (尝试次数: 2) https://registry.npmjs.org/@openai/codex/-/codex-0.134.0-linux-arm64.tgz
正在连接 192.168.123.32:7892... 已连接。
已发出 Proxy 请求,正在等待回应... 206 Partial Content
长度:83530982 (80M),剩余 78432294 (75M) [application/octet-stream]
正在保存至: "codex-linux-arm64.tgz"
codex-linux-arm64.tgz 12%[++++===> ] 9.68M 5.15MB/s 用时 0.9s
2026-05-28 03:27:47 (5.15 MB/s) - 在 10151744/83530982 字节处发生读取错误 (Error decoding the received TLS packet.)。重试中。
......(此处省略n次重试)
--2026-05-28 03:29:57-- (尝试次数:16) https://registry.npmjs.org/@openai/codex/-/codex-0.134.0-linux-arm64.tgz
正在连接 192.168.123.32:7892... 已连接。
已发出 Proxy 请求,正在等待回应... 206 Partial Content
长度:83530982 (80M),剩余 2652774 (2.5M) [application/octet-stream]
正在保存至: "codex-linux-arm64.tgz"
codex-linux-arm64.tgz 100%[++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++==>] 79.66M 3.09MB/s 用时 0.8s
2026-05-28 03:29:58 (3.09 MB/s) - 已保存 "codex-linux-arm64.tgz" [83530982/83530982])
也就是说下载这个包因为npm没有重试机制,中间下载失败就跳过了,导致codex包无法正确下载。
于是怀疑是代理问题,再次卸载,使用国内npm镜像,就成功了。
shell
npm install -g @openai/codex@0.134.0 --include=optional --registry=https://registry.npmmirror.com --verbose
npm verbose cli /usr/local/bin/node /usr/local/bin/npm
npm info using npm@11.9.0
npm info using node@v24.14.0
npm verbose title npm install @openai/codex@0.134.0
npm verbose argv "install" "--global" "@openai/codex@0.134.0" "--include" "optional" "--registry" "https://registry.npmmirror.com" "--loglevel" "verbose"
npm verbose logfile logs-max:10 dir:/home/simon/.npm/_logs/2026-05-27T19_35_28_002Z-
npm verbose logfile /home/simon/.npm/_logs/2026-05-27T19_35_28_002Z-debug-0.log
npm http cache https://registry.npmmirror.com/@openai%2fcodex 139ms (cache hit)
npm http cache https://registry.npmmirror.com/@openai%2fcodex 117ms (cache hit)
npm http cache https://registry.npmmirror.com/@openai%2fcodex 453ms (cache hit)
npm http cache https://registry.npmmirror.com/@openai%2fcodex 871ms (cache hit)
npm http cache https://registry.npmmirror.com/@openai%2fcodex 180ms (cache hit)
npm http cache https://registry.npmmirror.com/@openai%2fcodex 784ms (cache hit)
npm http cache https://registry.npmmirror.com/@openai%2fcodex 1646ms (cache hit)
npm http cache @openai/codex@https://registry.npmmirror.com/@openai/codex/-/codex-0.134.0.tgz 0ms (cache hit)
npm http cache @openai/codex-linux-arm64@https://registry.npmmirror.com/@openai/codex/-/codex-0.134.0-linux-arm64.tgz 0ms (cache hit)
npm http fetch GET 200 https://cdn.npmmirror.com/packages/%40openai/codex/0.134.0/codex-0.134.0.tgz 440ms (cache miss)
npm http fetch GET 200 https://cdn.npmmirror.com/packages/%40openai/codex/0.134.0-linux-arm64/codex-0.134.0-linux-arm64.tgz 10536ms (cache miss)
changed 2 packages in 15s
npm verbose cwd /tmp/codex
npm verbose os Linux 6.12.11-edge-sunxi64
npm verbose node v24.14.0
npm verbose npm v11.9.0
npm verbose exit 0
npm info ok
simon@iclaw-e8a384:/tmp/codex$ codex --version
codex-cli 0.134.0