code EIDLETIMEOUT npm error errno EIDLETIMEOUT npm error Invalid response body w...
错误信息
npm error code EIDLETIMEOUT
npm error errno EIDLETIMEOUT
npm error Invalid response body while trying to fetch https://registry.npmjs.org/@openai%2fcodex: Idle timeout reached for host `registry.npmjs.org:443`
npm error A complete log of this run can be found in: /Users/guolihong/.npm/_logs/2026-03-10T16_29_54_988Z-debug-0.log
AI 解决方案
报错分析报告
1.错误翻译
原文:Idle timeout reached for host `registry.npmjs.org:443`
译文:主机`registry.npmjs.org:443`的连接空闲超时
2.原因分析
registry.npmjs.org:443的连接因空闲时间过长被终止。@openai/codex包(https://registry.npmjs.org/@openai%2fcodex)的HTTP请求阶段。3.解决方案
# 方案1:延长npm fetch超时时间(单位:毫秒,示例设为120秒)
npm config set fetch-timeout 120000
# 方案2:切换至国内镜像源(如淘宝镜像)加速请求
npm config set registry https://registry.npmmirror.com/
# 重新执行原命令(如安装@openai/codex)
npm install @openai/codex
4. 预防措施
fetch-timeout(默认可能过短),避免网络波动导致超时。nrm管理镜像源(npm i -g nrm),快速切换验证源可用性。