Deploying NodeJS app to Heroku errors

Help! I’ve been troubleshooting and trying to fix bugs for 2 days now. Let me know if you see any errors. Thank you in advance.
ps. Since I’m a new user I had to delete the .com at the end of the herokuapp.com in my Heroku apps.

Heroku Logs

2020-08-11T05:12:40.482741+00:00 heroku[web.1]: Process exited with status 1
2020-08-11T05:12:40.531073+00:00 heroku[web.1]: State changed from starting to crashed
2020-08-11T05:13:05.051885+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=sheltered-fortress-61921.herokuapp request_id=518a760f-1bca-42c1-844a-bafc01bae4ad fwd="73.35.154.195" dyno= connect= service= status=503 bytes= protocol=https
2020-08-11T05:13:05.416958+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=sheltered-fortress-61921.herokuapp request_id=3b24f891-2766-429d-b827-55bc5f5443bc fwd="3.101.0.4" dyno= connect= service= status=503 bytes= protocol=http
2020-08-11T05:13:05.554096+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=sheltered-fortress-61921.herokuapp.com request_id=8dd65152-e5fb-4ba2-83d8-850dc998d0f6 fwd="73.35.154.195" dyno= connect= service= status=503 bytes= protocol=https

I’m thinking that my error is coming from my package.json but I can’t figure out what is wrong with it.

Package.json

{
  "name": "some-app",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": " node server.js"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "bcrypt": "^4.0.1",
    "bower": "^1.8.8",
    "cookie-parser": "^1.4.5",
    "express": "^4.17.1",
    "express-session": "^1.17.1",
    "passport": "^0.4.1",
    "passport-facebook": "^3.0.0",
    "passport-google": "^0.3.0",
    "passport-local": "^1.0.0",
    "passport-twitter": "^1.0.4",
    "path": "^0.12.7",
    "request": "^2.88.2"
  },
  "devDependencies": {
    "dotenv": "^8.2.0"
  }
}

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

1 Like

@nhcarrigan Oh okay. Thank you!

This does not appear to be an issue with your package.json. It looks like an issue with express not serving your routes correctly.

I ran into this same issue when I was deploying a contact form - I had forgotten to tell express to serve the static files from my public directory.

Is your code available somewhere we can view? Perhaps a GitHub repository?

maybe, include server.js too

Hmm, it looks like your server.js file includes app.use(express.static("public")), which is telling express that your static files are in the “public” folder - but your index.html is in a different folder.

This would be my first thing to experiment with for troubleshooting the error.

1 Like

I’m still getting an application error. Because my app uses handlebars the index.html is the main.handlebars in Views. So I’m not sure how I’d go about telling express that the static files are in the “views” folder. I tried changing it so it would point to views instead of public. Should I create an html file just for the purpose of this? and copy what’s in Handlebars?