【问题标题】:React App deploying but not running in herokuReact App部署但未在heroku中运行
【发布时间】:2020-04-23 15:41:46
【问题描述】:

提前感谢您对此问题的任何帮助,我已经尝试解决了几个小时...

我用 create-react-app 创建了一个 react 应用程序,它在本地服务器上运行良好,将它部署到 heroku 并成功部署,但它没有打开。 当我执行 heroku logs --tail 时,出现以下错误:

2020-04-23T15:32:00.547380+00:00 app[web.1]: ℹ 「wds」: Project is running at http://172.16.17.130/
2020-04-23T15:32:00.547959+00:00 app[web.1]: ℹ 「wds」: webpack output is served from
2020-04-23T15:32:00.548051+00:00 app[web.1]: ℹ 「wds」: Content not from webpack is served from /app/public
2020-04-23T15:32:00.548120+00:00 app[web.1]: ℹ 「wds」: 404s will fallback to /
2020-04-23T15:32:00.548312+00:00 app[web.1]: Starting the development server...
2020-04-23T15:32:00.548312+00:00 app[web.1]: 
2020-04-23T15:32:00.680072+00:00 heroku[web.1]: State changed from starting to crashed
2020-04-23T15:32:01.946329+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=portfolio-carlosamorim.herokuapp.com request_id=3c71f08a-4492-40b7-bb6c-82055d05f0bd fwd="89.153.213.119" dyno= connect= service= status=503 bytes= protocol=https
2020-04-23T15:32:02.587450+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=portfolio-carlosamorim.herokuapp.com request_id=3a20431f-789e-4da8-a151-438205b055e9 fwd="89.153.213.119" dyno= connect= service= status=503 bytes= protocol=https
2020-04-23T15:33:23.144950+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=portfolio-carlosamorim.herokuapp.com request_id=d043557d-ed3f-474a-ba84-0d14c2ac2696 fwd="89.153.213.119" dyno= connect= service= status=503 bytes= protocol=https
2020-04-23T15:33:23.414482+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=portfolio-carlosamorim.herokuapp.com request_id=f612d864-2e2e-4669-a33d-9b5edb23732d fwd="89.153.213.119" dyno= connect= service= status=503 bytes= protocol=https

我的 package.json :

https://github.com/CarlosAmorimProjects/portfolio/blob/master/package.json

有人遇到过同样的问题并解决了吗?

谢谢

【问题讨论】:

    标签: reactjs heroku


    【解决方案1】:

    更新:

    我能够部署它并且它在 Vercel.com 上运行,我使用 buildpack create-react-app 并且它运行良好,我无法在 heroku 上应用相同的 builpack。 我怀疑问题与此有关。

    【讨论】:

      【解决方案2】:

      部署时默认的 buildpack 是 node.js 的。您需要使用 create-react-app buildpack(如下所示)。

      heroku create $APP_NAME --buildpack mars/create-react-app
      git push heroku master
      heroku open
      

      帮助链接:https://dev.to/webdevraj/deploy-a-react-app-on-heroku-the-right-way-5efo

      【讨论】:

      • 非常感谢!搜索了该信息,但找不到。
      猜你喜欢
      • 2018-12-21
      • 2019-01-21
      • 2020-11-26
      • 2017-09-21
      • 2021-05-11
      • 1970-01-01
      • 2013-03-29
      • 2020-01-27
      • 1970-01-01
      相关资源
      最近更新 更多