方法一:终端更改npm的配置文件
查询或验证当前配置的镜像:
npm config get registry
npm切换成淘宝镜像:
npm config set registry https://registry.npm.taobao.org
方法二: 直接编辑npm的配置文件
直接修改registry的地址
sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
phantomjs_cdnurl=https://npm.taobao.org/mirrors/phantomjs/
electron_mirror=https://npm.taobao.org/mirrors/electron/
registry=https://registry.npm.taobao.org
方法三: 使用nrm管理registry地址
安装nrm
npm install -g nrm
查看镜像列表
nrm ls
切换镜像
nrm use taobao