Joe G
Joe G

Reputation: 109

Heroku with Express/Nodejs crashing?

I have a react/express application that I am trying to deploy on heroku. 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. Changed the "start" script in my package.json to a bunch of different commands with no luck. Seems to be getting stuck at root "/" and "/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

Upvotes: 0

Views: 79

Answers (1)

hong4rc
hong4rc

Reputation: 4113

You should move express to dependencies instead of devDependencies

Heroku throw the error:

Error: Cannot find module 'express'

You call it in your code. Heroku install only 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.

Upvotes: 1

Related Questions