设置淘宝镜像命令


npm作为国外的node仓库安装工具,自然会受到我大长城防火墙的干扰,国内用户在安装相关的资源的时候,会出现安装失败,以及速度很慢的情况。为了解决npm安装的问题,国内出现了很多npm的镜像网址,taobaonpm镜像算是使用频率比较高的了。

使用的方法我知道的有三种,首先是淘宝npm自己提供的两种:

 

1)你可以使用我们定制的 cnpm (gzip 压缩支持命令行工具代替默认的 npm:

$ npm install -g cnpm --registry=https://registry.npm.taobao.org

 

 

2)直接将本地的npm仓库指向淘宝的镜像地址

npm get registry 

> https://registry.npmjs.org

设成淘宝的

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

 

 

换成原来的

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

 

原文地址:https://www.cnblogs.com/hongsusu/p/8946285.html