- 检查网络设置,删除node_modules重新npm install
- 配置npm代理
// 配置nmp代理来提高速度,如设置淘宝镜像 npm config set registry https://registry.npm.taobao.org // 查看配置是否成功 npm config get registry // 成功后重新npm install安装 npm instal
- 使用nrm来管理npm镜像源
// 全局安装nrm (mac需要加上sudo) npm install -g nrm // 查看可配置的源列表 nrm ls // 使用配置列表中的源 nrm use taobao
- 使用cnpm来安装
// 全局安装cnpm (mac需要加上sudo) npm install cnpm -g --registry=https://registry.npmmirror.com // 成功后使用cnpm install安装 cnpm install
- 使用yarn来安装
// 全局安装yarn (mac需要加上sudo) npm install -g yarn // 成功后使用yarn install安装 yarn install
文章来源网络,作者:运维,如若转载,请注明出处:https://shuyeidc.com/wp/115222.html<