[英]Heroku with Express/Nodejs crashing?
I have a react/express application that I am trying to deploy on heroku.我有一个我试图在 heroku 上部署的 react/express 应用程序。 I am getting the following errors in my logs while trying to do so
尝试这样做时,我的日志中出现以下错误
2020-01-13T03:39:48.733455+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=react-hangman-4692.herokuapp.com request_id=1e4fdea9-888c-44b3-af81-230fddb46286 fwd="173.169.131.157" dyno= connect= service= status=503 bytes= protocol=https
2020-01-13T03:39:48.892866+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=react-hangman-4692.herokuapp.com request_id=970d21ca-0cc5-42f6-b29a-18f45cfe35b7 fwd="173.169.131.157" dyno= connect= service= status=503 bytes= protocol=https
I had used a procfile before and have since removed it.我之前使用过一个 procfile,后来删除了它。 Changed the "start" script in my package.json to a bunch of different commands with no luck.
将我的 package.json 中的“开始”脚本更改为一堆不同的命令,但没有运气。 Seems to be getting stuck at root "/" and "/favicon.ico".
似乎卡在根“/”和“/favicon.ico”上。 I replaced the favicon which also did nothing.
我替换了也没有做任何事情的图标。 Any ideas?
有任何想法吗?
And here is a tree of my project if that helps at all如果有帮助的话,这是我的项目树
.
├── client
│ ├── package.json
│ ├── package-lock.json
│ ├── public
│ │ ├── favicon.ico
│ │ ├── index.html
│ │ ├── logo192.png
│ │ ├── logo512.png
│ │ ├── manifest.json
│ │ └── robots.txt
│ ├── README.md
│ └── src
│ ├── App.css
│ ├── App.js
│ ├── App.test.js
│ ├── components
│ │ ├── App
│ │ │ ├── App.css
│ │ │ └── App.js
│ │ ├── Game
│ │ │ ├── Game.css
│ │ │ └── Game.js
│ │ ├── Leaderboard
│ │ │ ├── Leaderboard.css
│ │ │ └── Leaderboard.js
│ │ └── Title
│ │ ├── Title.css
│ │ └── Title.js
│ ├── img
│ │ ├── 0.png
│ │ ├── 1.png
│ │ ├── 2.png
│ │ ├── 3.png
│ │ ├── 4.png
│ │ ├── 5.png
│ │ ├── 6.png
│ │ └── 7.png
│ ├── index.css
│ ├── index.js
│ ├── routes.js
│ ├── serviceWorker.js
│ └── setupTests.js
├── models
│ └── Player.js
├── package.json
├── package-lock.json
├── routes
│ └── api
│ └── players.js
└── server.js
You should move express
to dependencies
instead of devDependencies
您应该将
express
移动到dependencies
而不是devDependencies
Heroku throw the error: Heroku 抛出错误:
Error: Cannot find module 'express'
You call it in your code.你在你的代码中调用它。 Heroku install only
dependencies
Heroku 仅安装
dependencies
https://devcenter.heroku.com/changelog-items/1376 : Many users getting started with Node.js on Heroku run a build step with webpack, ng-cli, or another build tool only to find that it's in their devDependencies and therefore not installed by default on Heroku . https://devcenter.heroku.com/changelog-items/1376 :许多开始在 Heroku 上使用 Node.js 的用户使用 webpack、ng-cli 或其他构建工具运行构建步骤,却发现它在他们的 devDependencies 中,并且因此默认情况下未安装在 Heroku 上。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.