npm设置国内镜像
方法1:修改成淘宝镜像
* 旧的域名是https://registry.npm.taobao.org,官方已更新为https://registry.npmmirror.com
npm config set registry https://registry.npmmirror.com
验证命令
npm config get registry
如果返回上面设置的域名,说明镜像配置成功。
* 也可以使用华为镜像,地址:https://mirrors.huaweicloud.com/repository/npm/
方法2:使用淘宝cnpm安装
安装cnpm
npm install -g cnpm --registry=https://registry.npmmirror.com
使用cnpm
cnpm install xxx
其它源:http://r.cnpmjs.org/