我一直在努力尝试将这个MERN应用程序部署到Heroku。我一直在跟踪针对我所看到的所有错误消息的解决方案,有时我感觉自己一直在进步,但是后来我又陷入了另一个错误的厄运。
查看代码:https://github.com/JoeBaldwin90/full-stack-kanban/tree/prod-setup
我的package.json
工作中的所有脚本,并且该应用程序在本地运行。甚至 Heroku构建成功:
remote: -----> Compressing...
remote: Done: 25.4M
remote: -----> Launching...
remote: Released v8
remote: https://myapp.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
但是,无论我尝试过无休止的错误消息列表有多少次,应用程序始终会崩溃并显示错误代码“ H10” :
2020-05-15T11:36:05.002242+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=full-stack-kanban.herokuapp.com request_id=3599345e-007a-4ea1-86e9-e8ff8c4383ff fwd="149.11.92.98" dyno= connect= service= status=503 bytes= protocol=https
2020-05-15T11:36:05.315982+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=full-stack-kanban.herokuapp.com request_id=bc53b825-f5f6-43c0-bcff-f5eeda8baeee fwd="149.11.92.98" dyno= connect= service= status=503 bytes= protocol=https
请有人可以帮助我了解如何进行调试。此时,我正在考虑向解决此问题的人员发送某种护理包...
当我运行heroku logs --tail
时:
2020-05-15T11:42:12.786651+00:00 heroku[web.1]: State changed from crashed to starting
2020-05-15T11:42:20.406032+00:00 app[web.1]:
2020-05-15T11:42:20.406056+00:00 app[web.1]: > mern-kanban@1.0.0 start /app
2020-05-15T11:42:20.406057+00:00 app[web.1]: > npm run server
2020-05-15T11:42:20.406057+00:00 app[web.1]:
2020-05-15T11:42:21.070984+00:00 heroku[web.1]: State changed from starting to crashed
2020-05-15T11:42:20.826159+00:00 app[web.1]:
2020-05-15T11:42:20.826162+00:00 app[web.1]: > mern-kanban@1.0.0 server /app
2020-05-15T11:42:20.826163+00:00 app[web.1]: > node src/server/server.mjs
2020-05-15T11:42:20.826163+00:00 app[web.1]:
2020-05-15T11:42:20.940568+00:00 app[web.1]: internal/modules/run_main.js:54
2020-05-15T11:42:20.940570+00:00 app[web.1]: internalBinding('errors').triggerUncaughtException(
2020-05-15T11:42:20.940570+00:00 app[web.1]: ^
2020-05-15T11:42:20.940571+00:00 app[web.1]:
2020-05-15T11:42:20.940572+00:00 app[web.1]: Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'mongodb' imported from /app/src/server/connect-db.mjs
2020-05-15T11:42:20.940572+00:00 app[web.1]: at packageResolve (internal/modules/esm/resolve.js:616:9)
2020-05-15T11:42:20.940573+00:00 app[web.1]: at moduleResolve (internal/modules/esm/resolve.js:655:14)
2020-05-15T11:42:20.940574+00:00 app[web.1]: at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:748:11)
2020-05-15T11:42:20.940574+00:00 app[web.1]: at Loader.resolve (internal/modules/esm/loader.js:97:40)
2020-05-15T11:42:20.940575+00:00 app[web.1]: at Loader.getModuleJob (internal/modules/esm/loader.js:243:28)
2020-05-15T11:42:20.940575+00:00 app[web.1]: at ModuleWrap.<anonymous> (internal/modules/esm/module_job.js:42:40)
2020-05-15T11:42:20.940575+00:00 app[web.1]: at link (internal/modules/esm/module_job.js:41:36) {
2020-05-15T11:42:20.940576+00:00 app[web.1]: code: 'ERR_MODULE_NOT_FOUND'
2020-05-15T11:42:20.940576+00:00 app[web.1]: }
2020-05-15T11:42:20.948354+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2020-05-15T11:42:20.948781+00:00 app[web.1]: npm ERR! errno 1
2020-05-15T11:42:20.950239+00:00 app[web.1]: npm ERR! mern-kanban@1.0.0 server: `node src/server/server.mjs`
2020-05-15T11:42:20.950406+00:00 app[web.1]: npm ERR! Exit status 1
2020-05-15T11:42:20.950594+00:00 app[web.1]: npm ERR!
2020-05-15T11:42:20.950735+00:00 app[web.1]: npm ERR! Failed at the mern-kanban@1.0.0 server script.
2020-05-15T11:42:20.950874+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-05-15T11:42:20.959421+00:00 app[web.1]:
2020-05-15T11:42:20.959644+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2020-05-15T11:42:20.959772+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2020-05-15T11_42_20_951Z-debug.log
2020-05-15T11:42:20.969460+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2020-05-15T11:42:20.969859+00:00 app[web.1]: npm ERR! errno 1
2020-05-15T11:42:20.971249+00:00 app[web.1]: npm ERR! mern-kanban@1.0.0 start: `npm run server`
2020-05-15T11:42:20.971356+00:00 app[web.1]: npm ERR! Exit status 1
2020-05-15T11:42:20.971509+00:00 app[web.1]: npm ERR!
2020-05-15T11:42:20.971633+00:00 app[web.1]: npm ERR! Failed at the mern-kanban@1.0.0 start script.
2020-05-15T11:42:20.971770+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-05-15T11:42:20.981451+00:00 app[web.1]:
2020-05-15T11:42:20.981658+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2020-05-15T11:42:20.981761+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2020-05-15T11_42_20_973Z-debug.log