Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NPM install gets Stuck and gives error (reason: connect ENETUNREACH)

when I run NPM install it get stuck for a moment on idealTree buildDeps and gives this error Is anyone else facing this issue??

    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

LOGS BELOW

 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)

I tried GITHUB

  1. Clearing Cache npm cache clear --force

  2. npm config set registry registry.npmjs.org --global

  3. then deleting package-lock.json and then running npm install

  4. npm install registry.npmjs.org (This gives the same error)

  5. Deleting npm config delete http_proxy / https_proxy

  6. Clearing Cache npm cache clear --force

  7. Also im not using proxy or on vpn

I Found a work around of this... When i connect with my mobile Data it works fine but not with my WIFI and it stopped working suddenly.

CONFIG LIST:

; "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

like image 813
Nabhdeep Avatar asked Dec 06 '25 20:12

Nabhdeep


2 Answers

I Found a work around of this... When i connect with my mobile Data it works fine but not with my WIFI and it stopped working suddenly.

This sticks out to me, I ran into a similar issue a day after being able to install dependencies without problems, while working on MacOS (M1/M2 chip) - apparently the hardware was configured to the option "Automatically" for IPv6 which is essential for your device conntection to the internet.

I switched from "Automatically" to "Link-local only" in my Network > TCP/IP configuration.

This issue is not specific to MacOS but any devices which may connect via IPv6

I describe the issue more closely here

like image 130
Mesa Avatar answered Dec 08 '25 09:12

Mesa


I had the same problem, This happen in node 18 not happen on 16. Then I just uninstalled 18 and installed 16 using nvm.

nvm uninstall 18
nvm install 16
nvm alias default 16
like image 25
Ariclene Chimbili Avatar answered Dec 08 '25 10:12

Ariclene Chimbili