Heroku 崩溃错误:heroku[router]:at=错误代码=H10 desc= "App crashed"方法=GET 路径= "/favicon.ico"



我正试图在heroku上启动我的nodejs应用程序。但每次它启动时都会崩溃,并出现以下错误。人们不断提到我必须进行一些端口修复,但我不明白在哪里以及如何进行?有人能帮我调试这个崩溃问题吗。。如果我使用npm start在本地运行它,它工作得很好。

这是我的回购:https://github.com/Gorgutzz/portfolio-site

2020-08-25T02:29:52.559666+00:00 heroku[web.1]: State changed from crashed to starting
2020-08-25T02:30:03.658131+00:00 heroku[web.1]: Starting process with command `npm start`
2020-08-25T02:30:06.506095+00:00 app[web.1]:
2020-08-25T02:30:06.506170+00:00 app[web.1]: > portfolio-site@0.1.0 start /app
2020-08-25T02:30:06.506176+00:00 app[web.1]: > react-scripts start
2020-08-25T02:30:06.506181+00:00 app[web.1]:
2020-08-25T02:30:09.243945+00:00 app[web.1]: ℹ 「wds」: Project is running at http://172.17.138.30/
2020-08-25T02:30:09.244281+00:00 app[web.1]: ℹ 「wds」: webpack output is served from
2020-08-25T02:30:09.244350+00:00 app[web.1]: ℹ 「wds」: Content not from webpack is served from /app/public
2020-08-25T02:30:09.244420+00:00 app[web.1]: ℹ 「wds」: 404s will fallback to /
2020-08-25T02:30:09.244654+00:00 app[web.1]: Starting the development server...
2020-08-25T02:30:09.244655+00:00 app[web.1]:
2020-08-25T02:30:09.336466+00:00 heroku[web.1]: Process exited with status 0
2020-08-25T02:30:09.382429+00:00 heroku[web.1]: State changed from starting to crashed
2020-08-25T02:30:17.664264+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=leo-port123.herokuapp.com request_id=d96f2dd2-7ebf-4123-a30a-2a499c5e826f fwd="24.102.208.138" dyno= connect= service
= status=503 bytes= protocol=http
2020-08-25T02:30:18.664310+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=leo-port123.herokuapp.com request_id=f5a14315-78c3-41b9-b90c-ae748f7f4800 fwd="24.102.208.138" dyno= conne
ct= service= status=503 bytes= protocol=http

Heroku在每次dyno启动时随机分配的端口上运行。你有三个选择:

  • 使用Heroku Buildpack进行零配置react应用程序:https://elements.heroku.com/buildpacks/mars/create-react-app-buildpack
  • 使用Expresshttps://medium.com/better-programming/how-to-deploy-your-react-app-to-heroku-aedc28b218ae
  • 使用其他手动设置端口的方法。这可能会有所帮助:在Heroku上为node.js服务器设置端口

相关内容