npm 配置仓库
查看当前仓库配置:
npm config list // 查看配置
npm config ls -l // 查看详细配置
可以看到 registry 配置,就是仓库地址
简述修改配置的 3 种方式:
1.通过 config 配置
npm config set registry https://registry.npm.taobao.org
2.每次执行命令前加 '--registry' 前缀,临时切换仓库地址
npm --registry https://registry.npm.taobao.org xxx
3.编辑 ~/.npmrc 配置文件
registry = https://registry.npm.taobao.org
复制代码
安装 nrm 来切换 npm 仓库
安装:
npm install nrm -g –save
命令:
1.显示所有仓库
nrm ls
* npm ----- https://registry.npmjs.org/
cnpm ---- http://r.cnpmjs.org/
taobao -- https://registry.npm.taobao.org/
nj ------ https://registry.nodejitsu.com/
rednpm -- http://registry.mirror.cqupt.edu.cn
skimdb -- https://skimdb.npmjs.com/registry
2.显示当前使用的仓库名
nrm current
3.切换仓库
nrm use 仓库名
4.添加仓库
nrm add 仓库名 仓库地址 [仓库主页]
5.删除仓库
nrm del 仓库名
6.打开仓库主页,可指定浏览器
nrm home 仓库名 [浏览器]
7.测试指定仓库的响应时间或所有仓库的响应时间
nrm test [仓库名]
复制代码
参考文章:
www.cnblogs.com/btgyoyo/p/6…
www.cnblogs.com/wangmeijian…
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END