6

I'm on vacation outside of the US where the connection is quite slow and npm install is giving me some trouble.

› npm config list
; cli configs
user-agent = "npm/3.7.3 node/v5.8.0 darwin x64"

; userconfig /Users/lfender/.npmrc
registry = "http://registry.npmjs.org/"
strict-ssl = false

; globalconfig /Users/lfender/.nvm/versions/node/v5.8.0/etc/npmrc
strict-ssl = false

; node bin location = /Users/lfender/.nvm/versions/node/v5.8.0/bin/node
; cwd = /Users/lfender/source/ag.js
; HOME = /Users/lfender
; "npm config ls -l" to show all defaults.

npm install --verbose
npm info retry will retry, error on last attempt: Error: connect ETIMEDOUT 151.101.56.162:443

I have tried setting the registry to http but it looks as though it is still trying to connect on 443 or ssl.

It continues to do this and retries over and over again. What else can I try to establish communication with the registry?

Even when connecting to corporate VPN housed in the US it still fails.

npm ERR! network connect ETIMEDOUT 151.101.56.162:443
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'
npm verb exit [ 1, true ]

I suspect its an issue with the ISP

random-forest-cat
  • 33,652
  • 11
  • 120
  • 99

4 Answers4

13

I faced a similar issue when on slow internet and on experimenting I found out that we can set the timeout value. So, doing

npm install -timeout=9999999

works for me as it sets the timeout to 9999999 ms.

Anit Singh
  • 131
  • 1
  • 5
1

I know it is not a real solution but this workaround could help.

After hours of struggling with the same problem, I had installed yarn and then installed the dependencies using yarn.

# 1: install yarn:
sudo npm install --global yarn

# 2: install packages from "package.json" with yarn:
yarn install

See also: "Yarn usage".

yarn also faced a really bad internet connection, but successfully installed dependent packages (even though with warnings):

info There appears to be trouble with your network connection. Retrying...

It seems like yarn is more dogged.

maxkoryukov
  • 4,205
  • 5
  • 33
  • 54
1

I solved the problem by first listing my configurations of my npm

npm config ls -l

Look after https-proxy/http-proxy and possibly you will find a setting like "http://10.10.20.60:80/". If it is there do the following command

npm config delete https-proxy

Afterwards try installing again with

npm install -g <what u want to install> 
Oracle
  • 11
  • 1
0

I was using node version 17.3.0 when I had this problem. I updated to node version 17.4.0 and it worked. Try to update your node if all else fails.

ouflak
  • 2,458
  • 10
  • 44
  • 49
Edem
  • 1