npm安装依赖的时候报错超时,如下:
npm error code ECONNRESET
npm error syscall read
npm error errno ECONNRESET
npm error network Invalid response body while trying to fetch https://registry.npmjs.org/element-plus: read ECONNRESET
npm error network This is a problem related to network connectivity.
npm error network In most cases you are behind a proxy or have bad network settings.
npm error network
npm error network If you are behind a proxy, please make sure that the
npm error network 'proxy' config is set properly. See: 'npm help config'
解决方法很简单:
执行以下代码,将 npm 的代理设置重置为无(即不使用代理),再次install就好了
npm config set proxy null
其他情况请参考下面的处理方法:
1、检查网络连接
2、切换淘宝源:
npm config set registry https://registry.npmmirror.com
3、使用yarn或者pnpm安装
4、关闭防火墙
5、检查npm版本,确保你使用的Node.js版本与npm兼容