NPM安装卡住并给出错误(原因:connect ENETUNREACH)

yeotifhr  于 2023-06-23  发布在  其他
关注(0)|答案(1)|浏览(337)

当我运行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)

我试过GITHUB
1.清除缓存npm cache clear --force

  1. npm配置集注册表registry.npmjs.org--global
    1.然后删除package-lock.json,然后运行npm install
  2. npm install registry.npmjs.org(这会产生相同的错误)
    1.删除npm配置删除http_proxy / https_proxy
    1.清除缓存npm cache clear --force
    1.也im不使用代理或在vpn
    我找到了一个工作围绕这个…当我连接我的移动的数据,它工作正常,但不是与我的WIFI和它停止工作突然。
    配置列表:
; "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
pdkcd3nj

pdkcd3nj1#

我遇到了同样的问题,这发生在节点18,而不是发生在16。然后我就卸载了18,用nvm安装了16。

nvm uninstall 18
nvm install 16
nvm alias default 16

相关问题