简体   繁体   English

部署到Heroku时React应用程序崩溃

[英]React App Crashes When Deployed to Heroku

I just deployed my React app to Heroku and while the deployment was successful, the ap crashes and I get an Application Error on the screen. 我刚将我的React应用程序部署到Heroku,而部署成功后,ap崩溃,并且在屏幕上出现Application Error。 I ran Heroku Logs and it returned this error: 我运行了Heroku Logs,它返回了此错误:

at=error code=H10 desc="App crashed" method=GET path="/" host=quoriron-
client-app.herokuapp.com request_id=fe82d878-75ce-47b2-a726-
513725e679f2 fwd="65.209.61.114" dyno= connect= service= status=503 
bytes= protocol=https

Other people have had that error with Node apps and it's seems to usually be an issue with setting the port, but from my understanding the port isn't set the same way in React (or if that's even the problem). 其他人在Node应用程序上遇到了这个错误,设置端口似乎通常是一个问题,但是据我了解,在React中端口设置的方式并不相同(或者甚至是问题所在)。

How can I prevent my React app from crashing because of this error? 如何防止我的React应用由于此错误而崩溃?

First sorry for reply this as an answer while it should be a comment... 首先,很抱歉回答这个问题,但它应该是评论。

How did you deploy the React app to Heroku?? 您是如何将React应用程序部署到Heroku的? Did you use their zero configuration for React apps or did you created your own Node.js that serve the react app? 您是否对React应用程序使用了零配置,还是创建了为React应用程序服务的自己的Node.js?

Also you'll need to add the correctly buildpack to the project. 另外,您需要将正确的buildpack添加到项目中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM