Node NPM proxy authentication - how do I configure it?

Funky picture Funky · Oct 21, 2016 · Viewed 68.8k times · Source

I'm new to Node and trying to install TypeScript using the following command:

npm install -g typescript

I get the following error:

if you are behind a proxy, please make sure that the 'proxy' config is set properly.

I have set my proxy using the following commands:

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

and tried this also:

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

But none of them work. I am working behind a copmpany proxy with authentication, so I think this is stopping me from connecting. I have added my username and password and this also didn't work.

Does anyone have any idea how I can connect to npm whilst using the company proxy and authentication?

Thanks

Answer

robmass picture robmass · Feb 14, 2017

Did you try with

npm config set proxy http://"ninjadev:5trongP@ssw0rd"@proxy.some-bigcorp.com:PORT
npm config set https-proxy http://"ninjadev:5trongP@ssw0rd"@proxy.some-bigcorp.com:PORT

where PORT can be 8080 if you don't have the proxy port?