当我运行 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
清除缓存 npm cacheclear --force
npm 配置集注册表registry.npmjs.org --global
然后删除 package-lock.json 然后运行 npm install
npm installregistry.npmjs.org(这会产生相同的错误)
删除npm配置删除http_proxy / https_proxy
清除缓存 npm cacheclear --force
我也没有使用代理或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
我遇到了同样的问题,这种情况发生在节点 18 上,而不是发生在节点 16 上。 然后我就卸载了18并使用nvm安装了16。
nvm uninstall 18
nvm install 16
nvm alias default 16
我找到了解决这个问题的方法...当我连接我的移动数据时,它工作正常,但与我的 WIFI 不同,它突然停止工作。
这对我来说很突出,在 MacOS(M1/M2 芯片)上工作时,能够毫无问题地安装依赖项一天后,我遇到了类似的问题 - 显然硬件已配置为 IPv6 的“自动”选项,即对于您的设备连接到互联网至关重要。
我在网络 > TCP/IP 配置中从“自动”切换到“仅限本地链路”。
此问题并非特定于 MacOS,而是任何可以通过 IPv6 连接的设备