Setup npm proxy in a corporate network

It’s painful to work behind a corporate network and everything does not work out of the box. Simple command like npm install would not work and here is how to work through the proxy:

Assuming you somehow get nodejs installed in your corporate laptop, open the .npmrc file which typical in the path for windows C:\Users\<your_user_id>\.npmrc or mac Users/<your_user_id>/npmrc

Edit the file with this:

https-proxy=http://yourcompanyproxy.com:80
proxy=http://yourcompanyproxy.com:80
strict-ssl=false
registry=http://registry.npmjs.org

Try to run npm install again it should work now!

One more tip if you have some dependency hosted in your corperate internal Nexus npm repository, for example in the @ npmcorp scope, then run the below command to nominate the correct registry URL:

npm config set @npmcorp:registry https://your-company-nexus:80/nexus/content/repository/npm-internal

Then you should be able to overcome dependency not found errors. Try it out :)