npm install报错npm ERR! Maximum call stack size exceeded
报错1
| npm ERR! Maximum call stack size exceeded |
复制
报错2
| npm ERR! code ETIMEDOUT |
| npm ERR! errno ETIMEDOUT |
| npm ERR! network request to https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding failed, reason: connect ETIMEDOUT 104.16.29.34:443 |
| npm ERR! network This is a problem related to network connectivity. |
| npm ERR! network In most cases you are behind a proxy or have bad network settings. |
| npm ERR! network |
| npm ERR! network If you are behind a proxy, please make sure that the |
| npm ERR! network 'proxy' config is set properly. See: 'npm help config' |
复制
原因:电脑开了代理
解决:关闭代理
报错3
| npm ERR! code ETIMEDOUTnpm ERR! syscall connectnpm ERR!errno ETIMEDOUT |
复制
报错4
| ERROR Failed to compile with 1 error 下午3:14:49 |
| |
| error in ./src/main.js |
复制

解决方案
1、首先检查nodejs和npm版本是否最新
注意:vscode中npm版本和cmd中的npm版本可能存在不一致,如果不一致,重启vscode或者重启电脑再重启vscode

2、镜像不合适
2.1、查看npm镜像设置
复制
2.2、将npm设置为淘宝镜像
| npm config set registry https://registry.npm.taobao.org |
复制
2.3、再次查看npm镜像设置
复制
3、忽略npm证书验证问题(npm安装完成后,再设置回true即可)
| npm config set strict-ssl false |
复制
4、删除package-lock.json和node_modules,清理缓存
复制
5、安装
复制
6、启动报错时,具体问题具体分析,如报错4,则执行具体安装命令即可,此处缺少eslint-plugin-standard
| npm install eslint-plugin-standard --save-dev |
复制
7、启动
复制