Config proxy for npm
The npm config files
FILES
The four relevant files are:
- per-project config file (/path/to/my/project/.npmrc)
- per-user config file (~/.npmrc)
- global config file ($PREFIX/etc/npmrc)
- npm builtin config file (/path/to/npm/npmrc)
Add the following entries in the config file:
proxy=http://proxy.company.com:8080https-proxy=user:password@http://proxy.company.com:8080
npm 6 way for configuration,priority is listed as following order:
Config parameter.--proxy http://server:port
It set proxy to:http://server:port
. Environment variable。npm_config_
as the prefix for the environment variable will be recognized as the environment parameter for npm. For example, you can set proxy by:npm_config_proxy=http://server:port
. User configuration document. Please enternpm config get userconfig
to check the user config path。Mac default path for user is$HOME/.npmrc
. Global configuration document. Please enternpm config get globalconfig
to check the global configuration path. Mac default path for global configuration is/usr/local/etc/npmrc
. Internal setting file. npmrc file which located in the npm installation directory. Default setting。
CLI Command
npm config set proxy http://proxy.company.com:8080 npm config set https-proxy http://user:password@proxy.company.com:8080
留言
張貼留言