背景:vue2的项目,之前npm run serve一直可以正常使用,突然每次启动都会报错了,报错信息如下:
node:events:492
throw er; // Unhandled 'error' event
^Error: read ECONNRESET
at TCP.onStreamRead (node:internal/stream_base_commons:217:20)
Emitted 'error' event on Socket instance at:
at emitErrorNT (node:internal/streams/destroy:151:8)
at emitErrorCloseNT (node:internal/streams/destroy:116:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
errno: -4077,
code: 'ECONNRESET',
syscall: 'read'
}
做了很多尝试,和node版本无关,和npm缓存也无关,和node_modules的依赖包也无关。
原因应该是:webSocket 走了本地代理,报错直接崩。关了本地websocket代理就行了
vue.config.js中的proxy中加上ws: false 重新npm run serve启动项目就行了。