使用Heroku的应用程序和GraphQl服务器部署问题

问题描述 投票:0回答:1

我制作了一个可与pyramida-graphql服务器一起使用的react应用程序。服务器位于react应用程序内部。我想用Heroku部署它(有史以来第一次使用它)。当我部署到Heroku时,运行heroku logs --tail

时会出现此错误
020-06-12T14:10:04.296156+00:00 heroku[web.1]: Process exited with status 0
2020-06-12T14:10:04.332716+00:00 heroku[web.1]: State changed from starting to crashed
2020-06-12T14:10:04.335407+00:00 heroku[web.1]: State changed from crashed to starting
2020-06-12T14:10:15.424387+00:00 heroku[web.1]: Starting process with command `npm start`
2020-06-12T14:10:17.947363+00:00 app[web.1]:
2020-06-12T14:10:17.947379+00:00 app[web.1]: > [email protected] start /app
2020-06-12T14:10:17.947379+00:00 app[web.1]: > react-scripts start
2020-06-12T14:10:17.947379+00:00 app[web.1]:
2020-06-12T14:10:20.724920+00:00 app[web.1]: ℹ 「wds」: Project is running at http://172.19.52.78/
2020-06-12T14:10:20.725386+00:00 app[web.1]: ℹ 「wds」: webpack output is served from
2020-06-12T14:10:20.725577+00:00 app[web.1]: ℹ 「wds」: Content not from webpack is served from /app/public
2020-06-12T14:10:20.725681+00:00 app[web.1]: ℹ 「wds」: 404s will fallback to /
2020-06-12T14:10:20.725971+00:00 app[web.1]: Starting the development server...
2020-06-12T14:10:20.725972+00:00 app[web.1]:
2020-06-12T14:10:20.803624+00:00 heroku[web.1]: Process exited with status 0
2020-06-12T14:10:20.835709+00:00 heroku[web.1]: State changed from starting to crashed
2020-06-12T14:27:07.241917+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=appoint-scheduler.herokuapp.com request_id=4a6d7846-488a-4a57-bd76-ee5b84c197fc fwd="94.227.127.41" dyno= connect= service= status=503 bytes= protocol=https
2020-06-12T14:27:07.688859+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=appoint-scheduler.herokuapp.com request_id=83928da3-bc4a-44f5-83fb-66a7c5b2611d fwd="94.227.127.41" dyno= connect= service= status=503 bytes= protocol=https

我在项目上使用的不是npm的yarn,有人知道我需要做些什么才能部署我的项目吗?因为我的项目未在heroku上运行,因为尝试打开已部署的版本时得到了此信息

Application error
An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details. You can do this from the Heroku CLI with the command
heroku logs --tail
reactjs heroku yarn heroku-cli prisma-graphql
1个回答
0
投票

我认为问题是您正在尝试在heroku上启动React开发服务器。您的react应用应作为静态js捆绑包提供,该捆绑包是在运行生产版本cmd npm run build之后生成的。

仅查看此用例开发的https://github.com/mars/create-react-app-buildpack,并使其更加容易。

[如果您要部署整个堆栈...请查看详细介绍了它的post

希望这会有所帮助!

© www.soinside.com 2019 - 2024. All rights reserved.