npm config set proxy http://proxy.company.com:8080 npm config set https-proxy http://proxy.company.com:8080If you need to specify credentials, they can be passed in the url using the following syntax.
http://user_name:password@proxy.company.com:8080Further exploration of the npm config documentation showed that the npm config set command sets the proxy configuration in your .npmrc file. You can also set the proxy configuration as a command line argument or environment variable.
npm --https-proxy=http://proxy.company.com:8080 -g install karmaTo pass configurattion parameters to npm as environment variables, they must be prefixed with npm_config_. The proxy configuration could be set with environment variables as follows.
export npm_config_proxy http://proxy.company.com:8080 export npm_config_https_proxy http://proxy.company.com:8080
Using NpUsing Npm Behindm Behind a Corporate Proxy
原文:http://my.oschina.net/sunpr/blog/356626