Setting Proxy NPM Install

Setting Proxy NPM Install

Once you install Node.js on your computer and if you working on corporate proxy then you will have to set up proxy for NPM install.

  • Open command prompt
  • Run the following commands replacing USERNAME, PASSWORD, PROXY_ADDRESS and PROXY_PORT with your company proxy server.
npm config set strict-ssl false
npm config set registry=http://registry.npmjs.org/
npm config set proxy http://USERNAME:PASSWORD@PROXY_ADDRESS:PROXY_PORT
npm config set https-proxy http://USERNAME:PASSWORD@PROXY_ADDRESS:PROXY_PORT
  • In some company you will have to include INTRANET/ before USERNAME. If above configuration doesn’t works try below:
npm config set strict-ssl false
npm config set registry=http://registry.npmjs.org/
npm config set proxy http://intranet%5CUSERNAME:PASSWORD@PROXY_ADDRESS:PROXY_PORT
npm config set https-proxy http://intranet%5CUSERNAME:PASSWORD@PROXY_ADDRESS:443

Note: Don’t forget to replace special character to URL encoding. For example if your company adds intranet/ then it will be intranet%5C (%5C is URL encoding of /)

intranet/ = intranet%5C

Important: Sometime special character give problem making connection. If your user id contains @ please replace it with some other character $ will be good.

Where will be location of above configuration: File name: .npmrc
Location: Windows XP: C:\Documents and Settings\USERNAME\.npmrc
Windows Vista+:  C:\Users\\USERNAME\.npmrc

Leave a Reply

Your email address will not be published. Required fields are marked *