Using NPM Install Behind A Corporate Proxy Server

Using NPM Install Behind A Corporate Proxy Server

If you use a desktop or workstation set up by your workplace then you’ve probably been here. Trying to install an npm package (e.g npm install -g create-react-app )and getting this error

This happens because your desktop or workstation is considered to use your institutions proxy server. Unfortunately it isn’t easy to google and sort out especially if you lead with the error message, you’ll probably get a lot of fixes which don’t sort your issue out. So today i’m going to show you how to sort out this irritating issue.

Step 1:

Go to Settings > Network and Internet > Proxy and find out the address and port. I advice copying and pasting it to Notepad or Sticky Notes

settings > network and internet > proxy

Step 2:

Go to command prompt or terminal depending on your machine(tip: hit Win + R and type cmd). In the command prompt type the following command npm config set proxy http://<username><password>@proxy-server-url>:<port> then config set https-proxy http://<username><password>@proxy-server-url>:<port> . Username and password really isn’t needed 9 times out of 10, the last 2 will suffice. Proxy-server-url is your address and your port is the port number. Once it’s set close command prompt and re-open it. And voila! you can now install all your packages.

If you find this useful please repost thanks.