内容

由于node.js源站点安装插件太慢又不稳定

淘宝的快,且淘宝10分钟就同步源一次


所以学习过程记录如下:


1.安装淘宝cnpm

npm install cnpm -g


2.使用cnpm

cnpm install express

此时在node_modules目录中,会有许多目录,听说是为加速安装用的(弄不懂)


3.临时用npc指向淘定源安装

npm --registry https://registry.npm.taobao.org install express 


4.持久使用

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

// 配置后可通过下面方式来验证是否成功 

npm config get registry 

// 或 

npm info express 


5.安装时cnpm代替默认的 npm

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



参考:

https://npm.taobao.org/

http://blog.csdn.net/wangmeng951011/article/details/52953517