npm管理 ¶
- npm配置
- npm镜像源配置
npm 镜像源 ¶
腾讯,华为,阿里的镜像站基本上比较全
修改镜像源 ¶
sh
#
# 1. 查看镜像库地址
#
# 查看配置,找到 registry
npm config list
# 或者直接
npm config get registry
#
# 2. 选择镜像源
#
#
# 3. 修改镜像源
#
# 3.1. 临时使用
npm install <PACKAGE_NAME> --registry https://registry.npmmirror.com/
# 3.2. 持久使用
npm config set registry https://registry.npmmirror.com/
# 全局设置国内源:
npm -g config set registry https://registry.npmmirror.com//
# 全局设置原始源:
npm -g config set registry https://registry.npmjs.org/
其他配置 ¶
- npm install 的时候不显示进度
sh
npm config set loglevel=error
npm config set silent true