DEV Community

Martin Soderlund Ek
Martin Soderlund Ek

Posted on

Set npm Proxy

When you do an npm install and get an error message like this one:

npm ERR! network request to failed, reason: Client network socket disconnected before secure TLS connection was established
npm ERR! network This is a problem 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'

Enter fullscreen mode Exit fullscreen mode

the problem might be you're behind a proxy and need to configure this for npm.

You need to set proxy and https-proxy for npm, like this (in your preferred command tool):

npm config set proxy http://your-proxy-url:8080
npm config set https-proxy https://your-proxy-url:8080
Enter fullscreen mode Exit fullscreen mode

Setting strict-ssl to false might be an idea too, if you really know what you're doing.

npm config set strict-ssl false
Enter fullscreen mode Exit fullscreen mode

Discussion (0)