NodeJS Express 应用程序在一段时间后崩溃

NodeJS Express app crashes after some time

NodeJS Express 应用程序在一段时间后崩溃。 我开始使用 npm start 启动脚本为

start: "node app.js"

错误

at Socket.emit (events.js:400:28)
    at emitErrorNT (internal/streams/destroy.js:106:8)
    at emitErrorCloseNT (internal/streams/destroy.js:74:3)
    at processTicksAndRejections (internal/process/task_queues.js:82:21) {
  errno: -104,
  code: 'ECONNRESET',
  syscall: 'read',
  fatal: true
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! xxx@1.0.0 start: `node app.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the xxx@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

当服务器运行几个小时时会发生这种情况。我想坚持到强行停止

我也用 nodemon app.js

试过了

“ECONNRESET”表示 TCP 对话的另一端突然关闭了它的连接端。这很可能是由于一个或多个应用程序协议错误。您可以查看 API 服务器日志,看看它是否抱怨什么。

但是由于您也在寻找一种方法来检查错误并可能调试问题,因此您应该看一下在 Whosebug 上发布的与类似问题相关的“How to debug a socket hang up error in NodeJS?”。