因为众所周知的原因,我们从拉取从官方源拉取npm 依赖,经常容易出现超时,拉取失败的情况。这个时候我们就非常有必要切换使用国内源了,如淘宝源等
1 |
npm --registry https://registry.npm.taobao.org install XXX(模块名) |
1 |
npm config get registry |
1 |
npm config set registry https://registry.npm.taobao.org |
1 |
npm config set registry https://registry.npmjs.org/ |
cnpm是一个命令,用它来代替npm
1 2 |
npm install -g cnpm --registry=https://registry.npm.taobao.org cnpm install XXX(模块名) |
nrm 是一个 npm 源管理器,允许你快速地在 npm源间切换
1 2 3 |
npm install -g nrm nrm use taobao nrm ls # 查看当前可用源命令 |
from:https://blog.csdn.net/Tiger_lin1/article/details/132710761