现象:项目中使用了websocket(不管何种websocket库,原生websocket、io.socket),只要websocket服务停止,npm run serve 就崩溃,如果一致调试前后端程序的话,崩溃了得重启,此问题一致困扰了我好几年了,一直没解决,今天终于借助ChatGpt解决了。
Proxy error: Could not proxy request /?secret=7315d6f0-ed6e-11ed-abb2-0ddfab4339a2&EIO=3&transport=websocket from localhost:8086 to http://127.0.0.1/socket.io/
node:child_process:960throw err;^Error: Command failed: npm run serveat checkExecSyncError (node:child_process:885:11) at execSync (node:child_process:957:15)at Object.<anonymous> (D:\dr\ics-new\branches\ics-2.1.4\ics-2.1.3\dr-soc-web\config\dev.js:39:1)at Module._compile (node:internal/modules/cjs/loader:1226:14)at Module._extensions..js (node:internal/modules/cjs/loader:1280:10)at Module.load (node:internal/modules/cjs/loader:1089:32)at Module._load (node:internal/modules/cjs/loader:930:12)at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)at node:internal/main/run_main_module:23:47 { status: 1,signal: null,output: [ null, null, null ],pid: 36796,stdout: null,stderr: null
}Node.js v18.14.0
解决办法:
process.on('uncaughtException', (err) => console.error(err))
原因: