首页 > 解决方案 > 无法在 heroku 上部署 react-app - 错误状态代码 503

问题描述

当我尝试在 heroku 上部署 react-app 时,它向我发送了以下应用程序 heroku 日志:它在本地运行,但不在 heroku 上

 State changed from starting to crashed

2020-05-15T11:25:55.816804+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=sakaar.herokuapp.com request_id=08accafa-0117-4e4d-a1b9-8538776d1640 fwd="27.34.50.89" dyno= connect= service= status=503 bytes= protocol=https

2020-05-15T11:27:58.085863+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=sakaar.herokuapp.com request_id=67f628ce-e6fe-41a5-803b-9f357854f8ba fwd="27.34.50.89" dyno= connect= service= status=503 bytes= protocol=https

2020-05-15T11:28:03.720923+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=sakaar.herokuapp.com request_id=8774160d-883e-4287-9a5d-1a50bbb22937 fwd="27.34.50.89" dyno= connect= service= status=503 bytes= protocol=https

2020-05-15T11:28:19.056335+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/postjob" host=sakaar.herokuapp.com request_id=66263e38-de26-4039-8061-90f60f2828bc fwd="27.34.50.89" dyno= connect= service= status=503 bytes= protocol=https

请帮我在 heroku 上部署这个 react-app。如果你需要什么,请告诉我。

标签: herokucreate-react-app

解决方案


这篇文章展示了你只需要几行就可以在两分钟内创建和部署一个 React 应用程序

您可以开始在 Heroku 上免费构建 React 应用程序。

npm install -g create-react-app
create-react-app my-app
cd my-app
git init
heroku create -b https://github.com/mars/create-react-app-buildpack.git
git add .
git commit -m "react-create-app on Heroku"
git push heroku master
heroku open

推荐阅读