You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

npm install遇ENETUNREACH错误,WiFi环境异常求助

npm install 触发 ENETUNREACH 错误求助

执行npm install时,程序在idealTree buildDeps阶段短暂卡住后抛出以下错误:

npm ERR! code ENETUNREACH

npm ERR! syscall connect
npm ERR! errno ENETUNREACH

npm ERR! request to https://registry.npmjs.org/npm failed, 
reason: connect ENETUNREACH

相关日志详情:

47 verbose type system
48 verbose stack FetchError: request to 
https://registry.npmjs.org/registry.npmjs.org failed, reason: 
connect ENETUNREACH 
48 verbose stack     at ClientRequest.<anonymous> 
(/usr/local/lib/node_modules/npm/node_modules/minipass-fetch/lib/index.js:130:14)
48 verbose stack     at ClientRequest.emit (node:events:513:28)
48 verbose stack     at TLSSocket.socketErrorListener (node:_http_client:490:9)
48 verbose stack     at TLSSocket.emit (node:events:525:35)
48 verbose stack     at emitErrorNT (node:internal/streams/destroy:151:8)
48 verbose stack     at emitErrorCloseNT (node:internal/streams/destroy:116:3)
48 verbose stack     at process.processTicksAndRejections 
(node:internal/process/task_queues:82:21)

已尝试的排查操作:

  • 执行npm cache clear --force清除缓存
  • 执行npm config set registry registry.npmjs.org --global设置全局镜像源
  • 删除package-lock.json后重新运行npm install
  • 执行npm install registry.npmjs.org(仍触发相同错误)
  • 执行npm config delete http_proxy及npm config delete https_proxy移除代理配置
  • 再次执行npm cache clear --force清除缓存

补充说明:未使用代理或VPN,但切换至移动数据网络时npm install可正常完成,WiFi环境下该问题为突然出现。

当前npm配置信息:

; "global" config from /usr/local/etc/npmrc

; registry = "https://registry.npmjs.org/" ; overridden by user

; "user" config from/xyz/.npmrc

registry = "https://registry.npmjs.org/" 

; "project" config from /Documents/xyz_api/.npmrc

legacy-peer-deps = true 

; "cli" config from command line options

location = "project" 

; node bin location = /usr/local/bin/node
; node version = v19.4.0
; npm local prefix = /Documents/xyz_api
; npm version = 9.2.0
; cwd = /Documents/xyz_api
; HOME = /home/xyz

请问是否有其他用户遇到过类似问题,或者有可行的解决办法?

内容的提问来源于stack exchange,提问作者Nabhdeep

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.03 22:15:28