npm 镜像配置
参考资料
nrm
安装
sh
npm install -g nrm
使用nrm
进行配置
提示
npm registry manager
(即:指的是 npm
的镜像源管理工具);
sh
# 列出镜像源地址
nrm ls
* npm ---------- https://registry.npmjs.org/
yarn --------- https://registry.yarnpkg.com/
tencent ------ https://mirrors.cloud.tencent.com/npm/
cnpm --------- https://r.cnpmjs.org/
taobao ------- https://registry.npmmirror.com/
npmMirror ---- https://skimdb.npmjs.com/registry/
sh
# 使用淘宝镜像源
nrm use taobao
Registry has been set to: https://registry.npmmirror.com/
sh
# 添加源
nrm add <registry> <url>
# 删除源
nrm del <registry>
# 测试源的响应时间
nrm test <registry>
基于项目范围修改
在项目添加.npmrc
文件
ini
registry=https://registry.npmmirror.com/
home=https://npm.taobao.org