1、查看当前的镜像地址
npm get registry
原镜像地址:
https://registry.npmjs.org/
设成淘宝的
npm config set registry http://registry.npm.taobao.org/
将npm替换为cnpm
npm install -g cnpm --registry=https://registry.npm.taobao.org
全局安装yarn
cnpm install yarn -g
2.换成原来的镜像地址
npm config set registry https://registry.npmjs.org/