无法将 GraphQL / ApolloServer / MongoDB / React App 部署到 Heroku

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

我使用 GraphQL、ApolloServer、MongoDB 和 React 制作了一个简单的应用程序。

回购在这里:https://github.com/MichaelAuricht/qna

我正在尝试使用以下指南将其部署到 heroku 和 mongoDB atlas: https://coding-boot-camp.github.io/full-stack/mongodb/deploy-with-heroku-and-mongodb-atlas

这在 2022 年 9 月对我有用,但由于某种原因我无法部署它。

任何建议或帮助将不胜感激。 TIA

我已经尝试了 heroku 在这里推荐的所有内容:https://devcenter.heroku.com/articles/troubleshooting-node-deploys

我真的不确定问题是什么以及为什么它不起作用,它可能与源代码本身有关?

这是最新的错误日志:

2023-03-28T03:10:10.000000+00:00 app[api]: Build started by user [email protected]
2023-03-28T03:10:25.815355+00:00 app[api]: Release v6 created by user [email protected]
2023-03-28T03:10:25.815355+00:00 app[api]: Deploy 2198af59 by user [email protected]
2023-03-28T03:10:25.826277+00:00 app[api]: Scaled to web@1:Basic by user [email protected]
2023-03-28T03:10:26.000000+00:00 app[api]: Build succeeded
2023-03-28T03:10:27.691834+00:00 heroku[web.1]: Starting process with command `npm start`
2023-03-28T03:10:29.488774+00:00 app[web.1]: npm ERR! Missing script: "start"
2023-03-28T03:10:29.488829+00:00 app[web.1]: npm ERR!
2023-03-28T03:10:29.488953+00:00 app[web.1]: npm ERR! Did you mean one of these?
2023-03-28T03:10:29.489064+00:00 app[web.1]: npm ERR!     npm star # Mark your favorite packages
2023-03-28T03:10:29.489174+00:00 app[web.1]: npm ERR!     npm stars # View packages marked as favorites
2023-03-28T03:10:29.489214+00:00 app[web.1]: npm ERR!
2023-03-28T03:10:29.489250+00:00 app[web.1]: npm ERR! To see a list of scripts, run:
2023-03-28T03:10:29.489290+00:00 app[web.1]: npm ERR!   npm run
2023-03-28T03:10:29.490375+00:00 app[web.1]:
2023-03-28T03:10:29.490513+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2023-03-28T03:10:29.490629+00:00 app[web.1]: npm ERR!     /app/.npm/_logs/2023-03-28T03_10_29_343Z-debug-0.log
2023-03-28T03:10:29.637586+00:00 heroku[web.1]: Process exited with status 1
2023-03-28T03:10:29.676343+00:00 heroku[web.1]: State changed from starting to crashed
2023-03-28T03:10:29.679822+00:00 heroku[web.1]: State changed from crashed to starting
2023-03-28T03:10:31.308800+00:00 heroku[web.1]: Starting process with command `npm start`
2023-03-28T03:10:33.155450+00:00 app[web.1]: npm ERR! Missing script: "start"
2023-03-28T03:10:33.155518+00:00 app[web.1]: npm ERR!
2023-03-28T03:10:33.155662+00:00 app[web.1]: npm ERR! Did you mean one of these?
2023-03-28T03:10:33.155779+00:00 app[web.1]: npm ERR!     npm star # Mark your favorite packages
2023-03-28T03:10:33.155896+00:00 app[web.1]: npm ERR!     npm stars # View packages marked as favorites
2023-03-28T03:10:33.155943+00:00 app[web.1]: npm ERR!
2023-03-28T03:10:33.155985+00:00 app[web.1]: npm ERR! To see a list of scripts, run:
2023-03-28T03:10:33.156031+00:00 app[web.1]: npm ERR!   npm run
2023-03-28T03:10:33.157211+00:00 app[web.1]:
2023-03-28T03:10:33.157385+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2023-03-28T03:10:33.157502+00:00 app[web.1]: npm ERR!     /app/.npm/_logs/2023-03-28T03_10_33_003Z-debug-0.log
2023-03-28T03:10:33.305763+00:00 heroku[web.1]: Process exited with status 1
2023-03-28T03:10:33.367692+00:00 heroku[web.1]: State changed from starting to crashed
2023-03-28T03:10:34.245978+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=ma-qna.herokuapp.com request_id=f4d22ea5-6e74-4814-be04-f8d31dd2ed07 fwd="124.170.206.191" dyno= connect= service= status=503 bytes= protocol=https
2023-03-28T03:10:34.576582+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=ma-qna.herokuapp.com request_id=51758a81-6a3c-4d95-b621-4c507903d9da fwd="124.170.206.191" dyno= connect= service= status=503 bytes= protocol=https
2023-03-28T03:10:35.385743+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=ma-qna.herokuapp.com request_id=6d69dffc-dcaa-4c9a-be1e-503cdfdcddf7 fwd="124.170.206.191" dyno= connect= service= status=503 bytes= protocol=https
2023-03-28T03:11:41.852017+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=ma-qna.herokuapp.com request_id=3d9b9d30-403d-4fe0-9872-bd9c6254e22b fwd="124.170.206.191" dyno= connect= service= status=503 bytes= protocol=https
2023-03-28T03:11:42.156842+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=ma-qna.herokuapp.com request_id=429bf622-07bc-45ba-bceb-5a0a3fa63a27 fwd="124.170.206.191" dyno= connect= service= status=503 bytes= protocol=https
2023-03-28T03:11:42.324928+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=ma-qna.herokuapp.com request_id=6e9d79a3-df04-453a-a2ca-da87a5c11f4a fwd="124.170.206.191" dyno= connect= service= status=503 bytes= protocol=https

这也是构建日志:

-----> Building on the Heroku-22 stack
-----> Using buildpack: heroku/nodejs
-----> Node.js app detected
       
-----> Creating runtime environment
       
       NPM_CONFIG_LOGLEVEL=error
       NODE_VERBOSE=false
       NODE_ENV=production
       NODE_MODULES_CACHE=true
       
-----> Installing binaries
       engines.node (package.json):  18.x
       engines.npm (package.json):   unspecified (use default)
       
       Resolving node version 18.x...
       Downloading and installing node 18.15.0...
       Using default npm version: 9.5.0
       
-----> Installing dependencies
       Installing node modules
       npm ERR! code EUSAGE
       npm ERR! 
       npm ERR! The `npm ci` command can only install with an existing package-lock.json or
       npm ERR! npm-shrinkwrap.json with lockfileVersion >= 1. Run an install with npm@5 or
       npm ERR! later to generate a package-lock.json file, then try again.
       npm ERR! 
       npm ERR! Clean install a project
       npm ERR! 
       npm ERR! Usage:
       npm ERR! npm ci
       npm ERR! 
       npm ERR! Options:
       npm ERR! [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle]
       npm ERR! [-E|--save-exact] [-g|--global]
       npm ERR! [--install-strategy <hoisted|nested|shallow|linked>] [--legacy-bundling]
       npm ERR! [--global-style] [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
       npm ERR! [--strict-peer-deps] [--no-package-lock] [--foreground-scripts]
       npm ERR! [--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
       npm ERR! [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
       npm ERR! [-ws|--workspaces] [--include-workspace-root] [--install-links]
       npm ERR! 
       npm ERR! aliases: clean-install, ic, install-clean, isntall-clean
       npm ERR! 
       npm ERR! Run "npm help ci" for more info
       
       npm ERR! A complete log of this run can be found in:
       npm ERR!     /tmp/npmcache.iyHIh/_logs/2023-03-28T02_41_07_203Z-debug-0.log
-----> Build failed
       
       We're sorry this build is failing! You can troubleshoot common issues here:
       https://devcenter.heroku.com/articles/troubleshooting-node-deploys
       
       If you're stuck, please submit a ticket so we can help:
       https://help.heroku.com/
       
       Love,
       Heroku
       
 !     Push rejected, failed to compile Node.js app.
 !     Push failed

heroku deployment graphql apollo-server mongodb-atlas
© www.soinside.com 2019 - 2024. All rights reserved.