使用npm小技巧
0 条评论背景
使用npm经常会遇到加载某个依赖加载不了,所以需要用国内的淘宝镜像
然而,将npm改成cnpm是极不习惯的,所以看到nrm就赶紧记下来了,极是好用!
安装使用
安装nrm
npm install nrm -g --registry=https://registry.npm.taobao.org
查看镜像
nrm ls
结果如下1
2
3
4
5
6
7* 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/
npmMirror https://skimdb.npmjs.com/registry/
edunpm - http://registry.enpmjs.org/
使用镜像
nrm use taobao
通过命令nrm ls
可以看到,镜像已经是taobao了1
2
3
4
5
6
7 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/
npmMirror https://skimdb.npmjs.com/registry/
edunpm - http://registry.enpmjs.org/
接下来就可以正常用npm安装依赖了,都很方便。
- 本文链接:http://www.icnws.com/2018/2018使用npm小技巧/
- 版权声明:本文由 简成 创作,采用 CC BY 3.0 CN协议 进行许可。 可自由转载、引用,但需署名作者且注明文章出处。交流沟通请加QQ:1503904712 或 邮件:dujc1018@gmail.com