If you happen to be behind a corporate firewall like me, chances are you have tons of problems with Node’s package manager,npm.
So here are some steps which might help you.
1. Setup NPM to use your proxy configuration
sudo npm config set proxy http://proxy.mycompany.comg:3128 sudo npm config set https-proxy https://proxy.mycompany.com:3128
2. Force your npm to use HTTP over HTTPS
You could do this by doing :
sudo npm config set registry http://registry.npmjs.org/
The above steps should work for majority of modules but it may not work for some.
3. If the module has a HTTPS reference explicitly in its package.json dependencies
Some modules specify the full URL in their dependencies other than just the name. If that is the case NPM would go and fetch the module from that URL . If the URL contains HHTPS although you have specified to use HHTP only but it would try to access HTTPS, so it would freeze there specially if your proxy server blocks that.
In this case:
3.1 Clone the repository to your local machine
3.2 Modify the package.json file and replace any HTTPS with HTTP
3.3 Install the local module
To install the module located in your local hard drive, use NPM and instead of module’s name, specify the path:
npm install module/
This should fix most of the issues with installing a module behind a corporate proxy.