npm install 超时 国内 切换源; npm ERR! code ELIFECYCLE;

install 超时

查看npm源地址

npm config get registry

#http://registry.npmjs.org 为国外镜像地址

设置阿里云镜像

npm config set registry http://registry.npm.taobao.org

如果不能解决

npm install --registry=https://registry.npm.taobao.org

重新运行npm命令,解决

npm ERR! code ELIFECYCLE

node_modules的问题,重新安装

rm -rf node_modules
rm package-lock.json
npm cache clear --force
npm install  # 很慢
npm run build

另一种设置镜像的方法

npm install -g cnpm --registry=http://registry.npm.taobao.org 
cnpm -v 
cnpm install

原文地址:https://www.cnblogs.com/wangjiale1024/p/11255643.html