NPM - Commonly used settings

NPM config

set

Set each config key to the provided value.
If value is omitted, then it sets it to an empty string.
Note: For backward compatibility, npm config set key value is supported as an alias for npm config set key=value.

npm config set key=value [key=value...]
npm set key=value [key=value...]
// 设置代理
npm config set proxy=http://代理服务器地址:端口号
// npm设置淘宝镜像
npm config set registry=https://registry.npm.taobao.org

get

Echo configuration values ​​to stdout.
If multiple keys are provided, the value will be prefixed with the key name.
If no key is provided, the command behaves the same as npm config list.

npm config get [key ...]
npm get [key ...]

list

Show all configuration settings; Use -l to also show defaults. Use --json to show the settings in json format.

npm config list

delete

cancel, delete (remove the specified key from all configuration files)

npm config delete key [key ...]
// 取消代理
npm config delete proxy
npm取消淘宝镜像
npm config delete registry

edit

Open the configuration file in an editor. Use the --global flag to edit the global configuration.

npm config edit

Guess you like

Origin blog.csdn.net/weixin_44897255/article/details/125169522