Reputation: 12897
I have installed node.js in my windows machine which is in a corporate network. So i will have to use my Id and password to access internet through the proxy server.
I have read that we can use npm config set proxy
to set the proxy.
npm config set proxy http://ABC\\123456:[email protected]:6050
I have tried it and is not working.
How can i specify the proxy details including username and password in NPM??
My user name is domain\username and password has special characters '!' and '@'
Upvotes: 2
Views: 11663
Reputation: 2316
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
Upvotes: 3
Reputation: 29
Open an command prompt or terminal session and run the following commands to configure npm to work with your web proxy. The commands use proxy.company.com as the address and 8080 as the port.
npm config set proxy http://proxy.company.com:8080
npm config set https-proxy http://proxy.company.com:8080
Upvotes: 0
Reputation: 14590
It's simple:
npm config set proxy http://username:[email protected]:8080
EDIT: Sorry didn't read about special chars:
You have to encode the special characters. E.g. instead of this:
http://username:p@[email protected]:8080
you have to write this:
http://username:p%[email protected]:8080
Upvotes: 0