December 13, 2016 10:12 by
Peter
In this article, let me show you how to setup Node.js proxy configurations on Windows. It is often required to work with Node.JS and NPM package installer behind the proxy. When trying to install npm packages behind the proxy, you may come across the error, given below:
To resolve exceptions, shown above, http_proxy and https_proxy configurations needs to be done for NPM. The step by step guidance is given below to perform the configuration on Windows machine.
- Go to C:\User\{User} directory.
- If .npmrc file exists then open it in notepad editor else create .npmrcfile.
- Add the lines, given below to the file for your valid AD domain user. proxy=http://domain\\username:password@ip:port
- Add the lines, given below for Non AD user proxy=http://username:password@ip:port
- Save .npmrc file
- Try to use npm install now. It should work without any error.
The sample contents of .npmrc file are shown below: