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
相关产品推荐
相关产品推荐

