npm安裝插件過程:從http://registry.npmjs.org下載對應的插件包(該網站服務器位於國外,所以經常下載緩慢或出現異常)
阿里在國內搭建了鏡像服務器:http://npm.taobao.org
需要執行以下命令更改:
npm config set registry https://registry.npm.taobao.org --global
npm config set disturl https://npm.taobao.org/dist --global
更改完成
使用 命令 npm config get registry 查看本地鏡像源
也可以使用下面方式
npm install cnpm -g -registry=https://registry.npm.taobao.org
部分機器出錯
解決方法:直接更新openssl
yum update openssl -y
完成再次install cnpm即可
cnpm等同於npm命令.用法一樣