Many times we will need to switch according to the source, but Taobao mirror usually install some errors in time, then you need to cut the source:
a: Taobao Mirror:
- temporary use:
npm --registry https://registry.npm.taobao.org install express
- Sustainable use:
npm config set registry https://registry.npm.taobao.org
- Use cnpm:
npm install -g cnpm --registry https://registry.npm.taobao.org
Two: Use the official image:
npm config set registry https://registry.npmjs.org/
Use nrm - NPM registry management tool
- Install
npm install -g nrm
- Example
$ nrm ls
* npm ---- https://registry.npmjs.org/
cnpm --- http://r.cnpmjs.org/
taobao - https://registry.npm.taobao.org/
nj ----- https://registry.nodejitsu.com/
npmMirror https://skimdb.npmjs.com/registry/
edunpm - http://registry.enpmjs.org/
from:https://www.jianshu.com/p/b2283aede1a0