【问题标题】:NodeJS Express app crashes after some timeNodeJS Express 应用程序在一段时间后崩溃
【发布时间】:2021-11-19 14:00:26
【问题描述】:

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

【问题讨论】:

标签: node.js express npm server


【解决方案1】:

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-11-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-21
    • 1970-01-01
    相关资源
    最近更新 更多