How can I configure node.js
and npm
to run behind a web proxy?
I tried the following solutions but they didn't work for me.
npm config set proxy http://proxy.company.com:8080
and
npm config set proxy http://username:[email protected]:8080
How can I configure node.js
and npm
to run behind a web proxy?
I tried the following solutions but they didn't work for me.
npm config set proxy http://proxy.company.com:8080
and
npm config set proxy http://username:[email protected]:8080
First open a command console at the location of your npm
installation.
Then you can configure your npm to use a proxy using the commands:
npm config set proxy http://{url}:{port}
npm config set https-proxy http://{url}:{port}
Notice the protocol is set to http
for both the proxy
and https-proxy
variables.
If you would like npm
to store your credentials for the proxy,
you can additionally modify the commands as follows:
npm config set proxy http://{username}:{passphrase}@{url}:{port}
npm config set https-proxy http://{username}:{passphrase}@{url}:{port}
For example:
npm config set proxy http://LanguidSquid:[email protected]:8080
npm config set https-proxy http://LanguidSquid:[email protected]:8080
Additional information here: Using npm behind corporate proxy .pac
This worked for me!
NOTE: Remember to add https:// instead of http:// when setting registry
Hope that helps.