Category Archives: Node.js

NPM behind an authenticated proxy

Playing around with npm (Node Package Manager?) needs a little bit of configuration if you are behind an authenticated corpoate proxy. I found myself in this situation while playing with npm at work for the first time. While trying to install some module, npm has shown the following message hinting that proxy configuration is not set.


To resolve this issue, simply configure http/https proxy settings with npm config command

npm config set proxy http://Username:Pa55w0rd@proxyhostname
npm config set https-proxy http://Username:Pa55w0rd@proxyhostname

Being behind an authenticated proxy in a corporate environment increases the probability that you have a very strong password enforced by your IS department. If you have special chars in your password, enclose your Username:Password pair in double quotes as shown in the example below.

npm config set proxy http://"ninjadev:5trongP@ssw0rd"
npm config set https-proxy http://"ninjadev:5trongP@ssw0rd"

Finally if you wish to verify if the settings are active, verify it by issuing the command

npm config ls *proxy