Node.js应用程序不断在Heroku上崩溃,给出错误的启动超时 [英] Node.js application keeps crashing on Heroku, gives error Boot timeout
问题描述
我正在开发一个示例node.js应用程序,它在
I'm developing a sample node.js application and it runs fine locally with
node index.js
但是,当我将其推送到Heroku实例时,它崩溃并出现以下错误:
but, when I push it to a Heroku instance, it crashes with the following errors:
2017-10-23T06:08:07.000000 + 00:00 app [api]:构建成功
2017-10-23T06:08:16.591817 + 00:00 heroku [web.1]:使用命令node --debug=5858 index.js
启动进程 2017-10-23T06:08:17.873171 + 00:00 app [web.1]:侦听[::]:5858
的调试器 2017-10-23T06:08:18.051769 + 00:00 app [web.1]:服务器正在侦听端口8080
2017-10-23T06:09:16.966905 + 00:00 heroku [web.1]:错误R10(启动超时)-> Web进程在启动后60秒内未能绑定到$ PORT
2017-10-23T06:09:16.966905 + 00:00 heroku [web.1]:使用SIGKILL停止进程
2017-10-23T06:09:17.062360 + 00:00 heroku [web.1]:进程退出,状态为137
2017-10-23T06:09:17.107893 + 00:00 heroku [web.1]:状态从开始更改为崩溃
2017-10-23T06:09:20.068453 + 00:00 heroku [router]:at =错误代码= H10 desc =应用程序崩溃"方法= GET路径="/contact"主机= obscure-meadow-84857.herokuapp.com request_id = 69c587a7-ba7f-49d3-8057-4b56338b2d01 fwd ="49.35.12.63" dyno = connect = service = status = 503字节= protocol = https
2017-10-23T06:09:20.137463 + 00:00 heroku [router]:at =错误代码= H10 desc =应用程序崩溃"方法= GET路径="/"主机= obscure-meadow-84857.herokuapp.com request_id = 44f48e7a-94aa-4c10-9578-e8f50f8aeec5 fwd ="49.35.12.63" dyno = connect = service = status = 503字节= protocol = https
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 commandnode --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文件设置如下:
My package.json file is set up as follows:
{
"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
,而不要使用您自己的应用程序.
Please use process.env.PORT
for your app instead of using your own.
这篇关于Node.js应用程序不断在Heroku上崩溃,给出错误的启动超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!