npm设置国内镜像

方法1:修改成淘宝镜像
npm config set registry https://registry.npm.taobao.org

验证命令
npm config get registry
如果返回https://registry.npm.taobao.org,说明镜像配置成功。

* 也可以使用华为镜像,地址:https://mirrors.huaweicloud.com/repository/npm/


方法2:使用淘宝cnpm安装
安装cnpm
npm install -g cnpm --registry=https://registry.npm.taobao.org

使用cnpm
cnpm install xxx

原文地址:https://www.cnblogs.com/live41/p/14646955.html