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.

Image

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"@proxy.some-bigcorp.com
npm config set https-proxy http://"ninjadev:5trongP@ssw0rd"@proxy.some-bigcorp.com

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

npm config ls *proxy

Image

Advertisements

About Praveen Kottarathil

Developer, uber geek, night owl and husband.

Posted on April 29, 2014, in JavaScript, Node.js. Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: