Pages

Friday, January 18, 2013

npm proxy configuration

To configure npm (Node Package Manager) to use a proxy server, check config page.
Basically, npm will use  HTTPS_PROXY or https_proxy or HTTP_PROXY or http_proxy environment variables. If that is not satisfactory, the proxy can be set via command:

npm config set https-proxy


In my case, the issues are mostly fixed by setting HTTPS_PROXY and HTTP_PROXY to the proxy server in format "server.domain:port", i.e. proxy.org:8080.
If there are still issues after setting these values, try running
npm cache clean
There is an issue for npm, here, and the suggested workaround is to use parameters:
npm install --proxy myproxy1.mydomain.com:3128 --registry=http://registry.npmjs.org/ socket.io

No comments: