-
Notifications
You must be signed in to change notification settings - Fork 2
NPM Behind Proxy
You might need to modify npm install
commands that access remote repositories (npmjs, for example) for installing Node JS modules; if your internet access is through a proxy server.
Proxy servers are common in college and business type environments.
You can locate your proxy settings from your browser's settings panel.
Once you have obtained the proxy settings (server URL, port, username and password); you need to configure your npm
configurations as follows.
$ npm config set proxy http://<username>:<password>@<proxy-server-url>:<port>
$ npm config set https-proxy http://<username>:<password>@<proxy-server-url>:<port>
You would have to replace <username>
, <password>
, <proxy-server-url>
, <port>
with the values specific to your proxy server credentials.
These fields are optional. For instance, your proxy server might not even require <username>
and <password>
, or that it might be running on port 80 (in which case <port>
is not required).
Once you have set these, your npm install
, npm i -g
etc. would work properly.
You should not have to use npm
commands with proxy settings, if either of the following happens:
- Your system administrator or corporate policy does not allow you to access remote
npm
repositories from NPM-JS, for instance.- The remote repository of Node modules in question is not in your machine, but it's within the internal network.
Use this blog post to unset your proxy settings. You can also manually remove the lines specifying your proxy settings from your .npmrc
file.
You may use the following resources for further reading on this:-
Learn to code and help nonprofits. Join our open source community in 15 seconds at http://freecodecamp.com
Follow our Medium blog
Follow Quincy on Quora
Follow us on Twitter
Like us on Facebook
And be sure to click the "Star" button in the upper right of this page.
New to Free Code Camp?
JS Concepts
JS Language Reference
- arguments
- Array.prototype.filter
- Array.prototype.indexOf
- Array.prototype.map
- Array.prototype.pop
- Array.prototype.push
- Array.prototype.shift
- Array.prototype.slice
- Array.prototype.some
- Array.prototype.toString
- Boolean
- for loop
- for..in loop
- for..of loop
- String.prototype.split
- String.prototype.toLowerCase
- String.prototype.toUpperCase
- undefined
Other Links