简体   繁体   English

React App 部署但未在 heroku 中运行

[英]React App deploying but not running in heroku

Thank you in advance for any help with this issue, i have been trying to solve it for some hours now...提前感谢您对这个问题的任何帮助,我已经尝试解决了几个小时......

I have created a react app with create-react-app and it's running fine in the local server, deployed it to heroku and it deployed sucessfully, but it does not open.我已经使用 create-react-app 创建了一个反应应用程序,它在本地服务器上运行良好,将其部署到 heroku 并成功部署,但它没有打开。 When i do heroku logs --tail i get the bellow errors:当我做 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

My package.json:我的 package.json:

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

Anyone experienced and solved the same issue?任何人都经历过并解决了同样的问题?

Thank you谢谢

Update:更新:

I was able to deploy it and it's running at Vercel.com, i used buildpack create-react-app and it's working perfectly, i cannot apply that same builpack on heroku.我能够部署它并且它在 Vercel.com 上运行,我使用 buildpack create-react-app 并且它运行良好,我无法在 heroku 上应用相同的 builpack。 I suspect the problem is related to that.我怀疑问题与此有关。

The default buildpack when deploying is that of node.js.部署时的默认 buildpack 是 node.js。 You needed to use the create-react-app buildpack (as seen below).您需要使用 create-react-app buildpack(如下所示)。

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

helpfull link: https://dev.to/webdevraj/deploy-a-react-app-on-heroku-the-right-way-5efo有用的链接: https://dev.to/webdevraj/deploy-a-react-app-on-heroku-the-right-way-5efo

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

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