无法在Heroku上运行我的节点应用程序.我附上了日志



我的节点应用程序在Glitch和DigitalOcean服务器中托管时运行良好。但当我在赫鲁库尝试时,它不起作用。

这是我运行heroku logs --tail:后得到的日志

›警告:heroku更新从7.35.0到7.39.5。2020-04-24T18:56:56.066168+00:0 app[api]:用户首次发布cuinjune@gmail.com2020-04-24T18:56:56.167629+00:0 app[api]:启用Logplex(按用户(cuinjune@gmail.com2020-04-25T02:56:56.167629+08:00app[api]:用户创建的版本v2cuinjune@gmail.com2020-04-24T18:56:56.066168+00:0 app[api]:用户创建的版本v1cuinjune@gmail.com2020-04-24T18:57:07.000000+000:00 app[api]:构建由用户启动cuinjune@gmail.com2020-04-24T18:57:25.352788+00:0app[api]:按用户部署1958e9f7cuinjune@gmail.com2020-04-24T18:57:25.370743+00:0 app[api]:缩放为web@1:免费者使用者cuinjune@gmail.com2020-04-24T18:57:25.352788+00:0应用程序[api]:用户创建的Release v3cuinjune@gmail.com2020-04-24T18:57:26.000000+000:00 app[api]:生成成功2020-04-24T18:57:30.065364+00:00应用程序[web.1]:2020-04-24T18:57:30.065389+00:00应用程序[web.1]:>battle-square@1.0.0启动/app 2020-04-24T18:57:30.065389+00:00-app[web.1]:>节点index.js 2020-04-24T18:57:30.065390+00:00应用程序[web.1]:2020-04-24T18:57:30.206325+00:00 app[web.1]:服务器正在运行端口上的本地主机:3000 2020-04-24T18:58:28.351045+00:0heroku[web.1]:状态从启动更改为崩溃2020-04-24T18:58:28.354624+00:0 heroku[web.1]:状态已从更改崩溃,无法启动2020-04-24T18:58:33.378248+00:0应用程序[web.1]:2020-04-24T18:58:33.37882+00:0应用程序[web.1]:>battle-square@1.0.0启动/app 2020-04-24T18:58:33.378283+00:0 app[web.1]:>节点index.js 2020-04-24T18:58:33.378283+00:0应用程序[web.1]:2020-04-24T18:58:33.576646+00:00 app[web.1]:服务器正在运行端口上的本地主机:3000 2020-04-24T18:58:52.316240+00:0heroku[路由器]:at=错误代码=H20 desc="应用程序启动超时"方法=GETpath="/"host=secureyrie-48591.horokuapp.comrequest_id=6ee36c25-45d3-4e0a-aae0-c9ddc89e1b69 fwd="69.116.190.29"dyno=连接=服务=状态=503字节=协议=https2020-04-24T18:59:31.070175+00:0 heroku[web.1]:状态已从更改开始崩溃2020-04-24T18:59:38.566167+00:0 heroku[路由器]:at=错误代码=H10 desc="应用程序崩溃"方法=GET路径="/"host=secureyrie-48591.horokuapp.comrequest_id=55127020-5b19-4154-885f-79287266284a fwd="69.116.190.29"dyno=连接=服务=状态=503字节=协议=https2020-04-24T18:59:39.185406+00:0 heroku[路由器]:at=错误代码=H10desc="应用程序崩溃"method=GET path="/favicon.ico"host=secureyrie-48591.horokuapp.comrequest_id=0f99d119-de28-4e80-a22d-0dab655469f7 fwd="69.116.190.29"dyno=连接=服务=状态=503字节=协议=https2020-04-24T19:00:26.640037+00:0 heroku[路由器]:at=错误代码=H10desc="应用程序崩溃"method=GET path="/"host=secureyrie-48591.horokuapp.comrequest_id=462f5dd6-c6ee-42d2-9251-50894d822936 fwd="69.116.190.29"dyno=连接=服务=状态=503字节=协议=https2020-04-24T19:00:27.065538+00:00 heroku[路由器]:at=错误代码=H10desc="应用程序崩溃"method=GET path="/favicon.ico"host=secureyrie-48591.horokuapp.comrequest_id=5e8e1903-9520-4c1e-a468-aecb35ba453f fwd="69.116.190.29"dyno=连接=服务=状态=503字节=协议=https2020-04-24T19:06:10.144325+00:00 heroku[路由器]:at=错误代码=H10desc="应用程序崩溃"method=GET path="/"host=secureyrie-48591.horokuapp.comrequest_id=ca404bc9-b117-42c9-82db-db0862572a8 fwd="69.116.190.29"dyno=连接=服务=状态=503字节=协议=https2020-04-24T19:06:10.679020+000:00 heroku[路由器]:at=错误代码=H10desc="应用程序崩溃"method=GET path="/favicon.ico"host=secureyrie-48591.horokuapp.comrequest_id=c18910bc-34ad-4ae0-8d88-b1dfbfed00f9 fwd="69.116.190.29"dyno=连接=服务=状态=503字节=协议=https

这里是我的回购链接:https://github.com/cuinjune/battle-square

问题出在哪里?如何解决?

原因在日志中:Server is running localhost on port: 3000

该应用程序使用端口3000,本地可以,但Heroku在部署时为您提供了一个动态端口,因此您需要绑定到该端口,该端口是通过env变量$port 提供的

最新更新