gpt4 book ai didi

javascript - heroku Nodejs 应用程序在部署后崩溃

转载 作者:行者123 更新时间:2023-12-02 20:59:47 25 4
gpt4 key购买 nike

您好,我的 Nodejs 应用程序在 Heroku 中崩溃并给了我这些错误日志。

** 这是我第一次使用 Heroku,所以请多多关照。我将不胜感激**

我第一次部署该程序时没有任何问题。随着时间的推移,它开始引起问题。我怀疑“mysql”与它有关

2020-04-22T21:24:00.718797+00:00 app[web.1]: ^
2020-04-22T21:24:00.718797+00:00 app[web.1]:
2020-04-22T21:24:00.718807+00:00 app[web.1]: Error: connect ECONNREFUSED

127.0.0.1:3306

2020-04-22T21:24:00.718808+00:00 app[web.1]: at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)
2020-04-22T21:24:00.718808+00:00 app[web.1]: --------------------
2020-04-22T21:24:00.718809+00:00 app[web.1]: at Protocol._enqueue (/app/node_modules/mysql/lib/protocol/Protocol.js:144:48)
2020-04-22T21:24:00.718809+00:00 app[web.1]: at Protocol.handshake (/app/node_modules/mysql/lib/protocol/Protocol.js:51:23)
2020-04-22T21:24:00.718810+00:00 app[web.1]: at Connection.connect (/app/node_modules/mysql/lib/Connection.js:116:18)
2020-04-22T21:24:00.718810+00:00 app[web.1]: at Object.<anonymous> (/app/app.js:38:14)
2020-04-22T21:24:00.718811+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1156:30)
2020-04-22T21:24:00.718811+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10)
2020-04-22T21:24:00.718812+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:1000:32)
2020-04-22T21:24:00.718812+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:899:14)
2020-04-22T21:24:00.718813+00:00 app[web.1]: at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
2020-04-22T21:24:00.718813+00:00 app[web.1]: at internal/main/run_main_module.js:18:47 {
2020-04-22T21:24:00.718813+00:00 app[web.1]: errno: 'ECONNREFUSED',
2020-04-22T21:24:00.718814+00:00 app[web.1]: code: 'ECONNREFUSED',
2020-04-22T21:24:00.718814+00:00 app[web.1]: syscall: 'connect',
2020-04-22T21:24:00.718815+00:00 app[web.1]: address: '127.0.0.1',
2020-04-22T21:24:00.718815+00:00 app[web.1]: port: 3306,
2020-04-22T21:24:00.718815+00:00 app[web.1]: fatal: true
2020-04-22T21:24:00.718815+00:00 app[web.1]: }
2020-04-22T21:24:00.723886+00:00 app[web.1]: [nodemon] app crashed - waiting for file changes before starting...
2020-04-22T21:24:58.000147+00:00 heroku[web.1]: State changed from starting to crashed
2020-04-23T03:16:28.416212+00:00 heroku[web.1]: State changed from crashed to starting
2020-04-23T03:16:34.242219+00:00 app[web.1]: [nodemon] 2.0.3
2020-04-23T03:16:34.244349+00:00 app[web.1]: [nodemon] to restart at any time, enter `rs`
2020-04-23T03:16:34.245212+00:00 app[web.1]: [nodemon] watching path(s): *.*
2020-04-23T03:16:34.245332+00:00 app[web.1]: [nodemon] watching extensions: js,mjs,json
2020-04-23T03:16:34.245784+00:00 app[web.1]: [nodemon] starting `node app.js`
2020-04-23T03:16:34.482576+00:00 app[web.1]: Warning: connect.session() MemoryStore is not
2020-04-23T03:16:34.482578+00:00 app[web.1]: designed for a production environment, as it will leak
2020-04-23T03:16:34.482579+00:00 app[web.1]: memory, and will not scale past a single process.
2020-04-23T03:16:34.609737+00:00 app[web.1]: server started at 5000 .....
2020-04-23T03:16:34.624972+00:00 app[web.1]: /app/app.js:39
2020-04-23T03:16:34.624975+00:00 app[web.1]: if(err) throw err
2020-04-23T03:16:34.624976+00:00 app[web.1]: ^
2020-04-23T03:16:34.624976+00:00 app[web.1]:
2020-04-23T03:16:34.624978+00:00 app[web.1]: Error: connect ECONNREFUSED 127.0.0.1:3306
2020-04-23T03:16:34.624979+00:00 app[web.1]: at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)
2020-04-23T03:16:34.624979+00:00 app[web.1]: --------------------
2020-04-23T03:16:34.624980+00:00 app[web.1]: at Protocol._enqueue (/app/node_modules/mysql/lib/protocol/Protocol.js:144:48)
2020-04-23T03:16:34.624981+00:00 app[web.1]: at Protocol.handshake (/app/node_modules/mysql/lib/protocol/Protocol.js:51:23)
2020-04-23T03:16:34.624982+00:00 app[web.1]: at Connection.connect (/app/node_modules/mysql/lib/Connection.js:116:18)
2020-04-23T03:16:34.624982+00:00 app[web.1]: at Object.<anonymous> (/app/app.js:38:14)
2020-04-23T03:16:34.624983+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1156:30)
2020-04-23T03:16:34.624983+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10)
2020-04-23T03:16:34.624984+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:1000:32)
2020-04-23T03:16:34.624985+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:899:14)
2020-04-23T03:16:34.624985+00:00 app[web.1]: at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
2020-04-23T03:16:34.624986+00:00 app[web.1]: at internal/main/run_main_module.js:18:47 {
2020-04-23T03:16:34.624986+00:00 app[web.1]: errno: 'ECONNREFUSED',
2020-04-23T03:16:34.624986+00:00 app[web.1]: code: 'ECONNREFUSED',
2020-04-23T03:16:34.624987+00:00 app[web.1]: syscall: 'connect',
2020-04-23T03:16:34.624987+00:00 app[web.1]: address: '127.0.0.1',
2020-04-23T03:16:34.624988+00:00 app[web.1]: port: 3306,
2020-04-23T03:16:34.624988+00:00 app[web.1]: fatal: true
2020-04-23T03:16:34.624989+00:00 app[web.1]: }
2020-04-23T03:16:34.633005+00:00 app[web.1]: [nodemon] app crashed - waiting for file changes before starting...
2020-04-23T03:17:31.123834+00:00 heroku[web.1]: State changed from starting to crashed
2020-04-23T04:49:42.724399+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=bhutandummy.herokuapp.com request_id=492ca9c3-4942-4494-aba1-28241e7270d2 fwd="119.2.126.78"
dyno= connect= service= status=503 bytes= protocol=https
2020-04-23T04:49:43.246961+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=bhutandummy.herokuapp.com request_id=1991b30d-ec0f-45c7-bff5-0425b423cd72 fwd="119.2.126.78" dyno= connect= service= status=503 bytes= protocol=https
2020-04-23T08:50:36.757655+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=bhutandummy.herokuapp.com request_id=4b4b18d2-f1ba-4444-8290-e0eb6fcea7b4 fwd="119.2.126.78"
dyno= connect= service= status=503 bytes= protocol=https
2020-04-23T08:50:38.869789+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=bhutandummy.herokuapp.com request_id=7bbb96b2-6484-473e-a6d3-f650e68d22a7 fwd="119.2.126.78" dyno= connect= service= status=503 bytes= protocol=https
2020-04-23T08:52:48.037968+00:00 heroku[web.1]: State changed from crashed to starting
2020-04-23T08:52:52.707642+00:00 app[web.1]: [nodemon] 2.0.3
2020-04-23T08:52:52.708830+00:00 app[web.1]: [nodemon] to restart at any time, enter `rs`
2020-04-23T08:52:52.709296+00:00 app[web.1]: [nodemon] watching path(s): *.*
2020-04-23T08:52:52.709387+00:00 app[web.1]: [nodemon] watching extensions: js,mjs,json
2020-04-23T08:52:52.709809+00:00 app[web.1]: [nodemon] starting `node app.js`
2020-04-23T08:52:52.917114+00:00 app[web.1]: Warning: connect.session() MemoryStore is not
2020-04-23T08:52:52.917116+00:00 app[web.1]: designed for a production environment, as it will leak
2020-04-23T08:52:52.917117+00:00 app[web.1]: memory, and will not scale past a single process.
2020-04-23T08:52:53.033929+00:00 app[web.1]: server started at 5000 .....
2020-04-23T08:52:53.049644+00:00 app[web.1]: /app/app.js:39
2020-04-23T08:52:53.049647+00:00 app[web.1]: if(err) throw err
2020-04-23T08:52:53.049649+00:00 app[web.1]: ^
2020-04-23T08:52:53.049650+00:00 app[web.1]:
2020-04-23T08:52:53.049650+00:00 app[web.1]: Error: connect ECONNREFUSED 127.0.0.1:3306
2020-04-23T08:52:53.049651+00:00 app[web.1]: at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)
2020-04-23T08:52:53.049652+00:00 app[web.1]: --------------------
2020-04-23T08:52:53.049652+00:00 app[web.1]: at Protocol._enqueue (/app/node_modules/mysql/lib/protocol/Protocol.js:144:48)
2020-04-23T08:52:53.049653+00:00 app[web.1]: at Protocol.handshake (/app/node_modules/mysql/lib/protocol/Protocol.js:51:23)
2020-04-23T08:52:53.049653+00:00 app[web.1]: at Connection.connect (/app/node_modules/mysql/lib/Connection.js:116:18)
2020-04-23T08:52:53.049654+00:00 app[web.1]: at Object.<anonymous> (/app/app.js:38:14)
2020-04-23T08:52:53.049654+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1156:30)
2020-04-23T08:52:53.049655+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10)
2020-04-23T08:52:53.049655+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:1000:32)
2020-04-23T08:52:53.049656+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:899:14)
2020-04-23T08:52:53.049656+00:00 app[web.1]: at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
2020-04-23T08:52:53.049657+00:00 app[web.1]: at internal/main/run_main_module.js:18:47 {
2020-04-23T08:52:53.049657+00:00 app[web.1]: errno: 'ECONNREFUSED',
2020-04-23T08:52:53.049658+00:00 app[web.1]: code: 'ECONNREFUSED',
2020-04-23T08:52:53.049658+00:00 app[web.1]: syscall: 'connect',
2020-04-23T08:52:53.049658+00:00 app[web.1]: address: '127.0.0.1',
2020-04-23T08:52:53.049659+00:00 app[web.1]: port: 3306,
2020-04-23T08:52:53.049659+00:00 app[web.1]: fatal: true
2020-04-23T08:52:53.049660+00:00 app[web.1]: }
2020-04-23T08:52:53.076322+00:00 app[web.1]: [nodemon] app crashed - waiting for file changes before starting...
2020-04-23T08:53:50.942306+00:00 heroku[web.1]: State changed from starting to crashed

如何修复它?

最佳答案

无法连接到 MySQL。可能为 MySQL 提供了错误的凭据。

关于javascript - heroku Nodejs 应用程序在部署后崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61385258/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com