/ Zhaoyun's Blog / npm添加淘宝镜像

npm添加淘宝镜像

2018-03-15 posted in [技术]

npm是一个很好用的工具,全场是Node Packet Manager,是一个nodejs的包管理工具,但是美中不足的是当我们去安转包的时候却发现下载的速度太慢,但是没关系,还是有方法的就是利用淘宝的国内镜像,一下是3个设置的方法:

镜像使用方法(三种办法任意一种都能解决问题,建议使用第三种,将配置写死,下次用的时候配置还在):

1.通过config命令

npm config set registry https://registry.npm.taobao.org

npm info underscore (如果上面配置正确这个命令会有字符串response)

2.命令行指定

npm –registry https://registry.npm.taobao.org info underscore

3.编辑 ~/.npmrc 加入下面内容

registry = https://registry.npm.taobao.org