使用阿里的cnpm代替默认的npm:
npm install -g cnpm --registry=https://registry.npm.taobao.org
检测是否安装成功:
cnpm -v
npm install --registry=https://registry.npm.taobao.org
npm config set registry https://registry.npm.taobao.org
手动修改设置
打开.npmrc文件(C:\Program Files\nodejs\node_modules\npm\npmrc
添加registry =https://registry.npm.taobao.org
检测是否更换成功
npm config get registry
npm config set registry https://registry.npmjs.org/
原文:https://www.cnblogs.com/my466879168/p/12430372.html