gpt4 book ai didi

javascript - Node.js 应用程序在 Heroku 上不断崩溃,给出错误引导超时

转载 作者:行者123 更新时间:2023-11-30 09:30:01 25 4
gpt4 key购买 nike

我正在开发一个示例 node.js 应用程序,它在本地运行良好

node index.js

但是,当我将它推送到 Heroku 实例时,它崩溃并出现以下错误:

2017-10-23T06:08:07.000000+00:00 app[api]: Build succeeded
2017-10-23T06:08:16.591817+00:00 heroku[web.1]: Starting process with command node --debug=5858 index.js
2017-10-23T06:08:17.873171+00:00 app[web.1]: Debugger listening on [::]:5858
2017-10-23T06:08:18.051769+00:00 app[web.1]: Server listening on port 8080
2017-10-23T06:09:16.966905+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2017-10-23T06:09:16.966905+00:00 heroku[web.1]: Stopping process with SIGKILL
2017-10-23T06:09:17.062360+00:00 heroku[web.1]: Process exited with status 137
2017-10-23T06:09:17.107893+00:00 heroku[web.1]: State changed from starting to crashed
2017-10-23T06:09:20.068453+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/contact" host=obscure-meadow-84857.herokuapp.com request_id=69c587a7-ba7f-49d3-8057-4b56338b2d01 fwd="49.35.12.63" dyno= connect= service= status=503 bytes= protocol=https
2017-10-23T06:09:20.137463+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=obscure-meadow-84857.herokuapp.com request_id=44f48e7a-94aa-4c10-9578-e8f50f8aeec5 fwd="49.35.12.63" dyno= connect= service= status=503 bytes= protocol=https

我的 package.json 文件设置如下:

{
"name": "testapp",
"version": "1.0.0",
"description": "A little test application",
"main": "basicRouting.js",
"dependencies": {
"ejs": "^2.5.7",
"express": "^4.16.2"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node server.js"
},
"keywords": [
"tutorial"
],
"author": "Debaditya Dey",
"license": "ISC"
}

谁能帮我解决这个问题?

最佳答案

2017-10-23T06:09:16.966905+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch

请为您的应用使用 process.env.PORT 而不是您自己的。

关于javascript - Node.js 应用程序在 Heroku 上不断崩溃,给出错误引导超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46883036/

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