npm install 时,卡住不动,五种解决方法

npm install 时,卡住不动,五种解决方法

 

运行npm install 时,卡住不动,五种解决方法
检查网络设置,删除node_modules重新npm install

配置npm代理

1
2
3
4
5
6
7
8
//  配置nmp代理来提高速度,如设置淘宝镜像
npm config set registry https://registry.npm.taobao.org
 
// 查看配置是否成功
npm config get registry
 
// 成功后重新npm install安装
npm install

使用nrm来管理npm镜像源

1
2
3
4
5
6
7
8
// 全局安装nrm (mac需要加上sudo)
npm install -g nrm
 
// 查看可配置的源列表
nrm ls
 
// 使用配置列表中的源
nrm use taobao

使用cnpm来安装

1
2
3
4
5
// 全局安装cnpm (mac需要加上sudo)
npm install cnpm -g --registry=https://registry.npmmirror.com
 
// 成功后使用cnpm install安装
cnpm install

使用yarn来安装

1
2
3
4
5
// 全局安装yarn (mac需要加上sudo)
npm install -g yarn
 
// 成功后使用yarn install安装
yarn install
 

posted on 2024-01-25 17:30  刘应杰  阅读(74)  评论(0编辑  收藏  举报

导航