# Node app on Heroku - getting “Application Error”

**URL:** <https://forum.freecodecamp.org/t/node-app-on-heroku-getting-application-error/170632>\
**Category:** Curriculum Help\
**Tags:** javascript\
**Created:** [January 24, 2018, 11:47am UTC](https://forum.freecodecamp.org/t/node-app-on-heroku-getting-application-error/170632 "2018-01-24T11:47:10Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![victornice](https://avatars.discourse-cdn.com/v4/letter/v/3bc359/32.png) [@victornice](https://forum.freecodecamp.org/u/victornice)\
**Post date:** [January 24, 2018, 11:47am UTC](https://forum.freecodecamp.org/t/node-app-on-heroku-getting-application-error/170632/1 "2018-01-24T11:47:10Z")

</div>

Greeting, campers!

I have looked through the similar topics and have so far been unable to resolve my deployment issue.

when I’ve deployed it I get an application error. tried to delete it and deploy it again but nothing happened.

[https://firetodo.herokuapp.com/](https://firetodo.herokuapp.com/)

---

<div class="post-metadata">

**Author:** ![BenGitter](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/bengitter/32/12192_2.png) [@BenGitter](https://forum.freecodecamp.org/u/BenGitter)\
**Post date:** [January 24, 2018, 11:48am UTC](https://forum.freecodecamp.org/t/node-app-on-heroku-getting-application-error/170632/2 "2018-01-24T11:48:27Z")

</div>

> If you are the application owner, check your logs for details.

---

<div class="post-metadata">

**Author:** ![victornice](https://avatars.discourse-cdn.com/v4/letter/v/3bc359/32.png) [@victornice](https://forum.freecodecamp.org/u/victornice)\
**Post date:** [January 24, 2018, 11:49am UTC](https://forum.freecodecamp.org/t/node-app-on-heroku-getting-application-error/170632/3 "2018-01-24T11:49:49Z")

</div>

**this is log file:**

2018-01-24T11:20:22.865825+00:00 app[web.1]: npm ERR! missing script: start  
2018-01-24T11:20:22.873590+00:00 app[web.1]:  
2018-01-24T11:20:22.873869+00:00 app[web.1]: npm ERR! A complete log of this run  
can be found in:  
2018-01-24T11:20:22.873936+00:00 app[web.1]: npm ERR! /app/.npm/\_logs/2018-01-24T11\_20\_22\_867Z-debug.log  
2018-01-24T11:20:22.931940+00:00 heroku[web.1]: Process exited with status 1  
2018-01-24T11:20:22.945935+00:00 heroku[web.1]: State changed from starting to crashed  
2018-01-24T11:20:36.935697+00:00 heroku[router]: at=error code=H10 desc=“App crashed” method=GET path="/" [host=firetodo.herokuapp.com](http://host=firetodo.herokuapp.com) request\_id=5de4a770-d007-42e6-9450-7edbf746d064 fwd=“197.39.19.110” dyno= connect= service= status=503 bytes= protocol=https  
2018-01-24T11:20:38.405704+00:00 heroku[router]: at=error code=H10 desc=“App crashed” method=GET path="/favicon.ico" host=firetodo.herokuapp request\_id=611d73af-f491-4ea8-ad41-9625c2e28f5f fwd=“197.39.19.110” dyno= connect= service= status=503 bytes= protocol=https  
2018-01-24T11:45:29.690322+00:00 heroku[router]: at=error code=H10 desc=“App crashed” method=GET path="/" host=firetodo.herokuapp request\_id=e6977494-b030-48c8-8f79-e95d05711700 fwd=“197.39.19.110” dyno= connect= service= status=503 bytes= protocol=https  
2018-01-24T11:45:34.106377+00:00 heroku[router]: at=error code=H10 desc=“App crashed” method=GET path="/favicon.ico" host=firetodo.herokuapp request\_id=09d16c24-35ff-4930-a7c2-ff2c0fa15c08 fwd=“197.39.19.110” dyno= connect= service= status=503 bytes= protocol=https  
2018-01-24T11:45:41.177551+00:00 heroku[router]: at=error code=H10 desc=“App crashed” method=HEAD path="/" host=firetodo.herokuapp request\_id=390ba626-8c8c-4909-a3f4-6d8ff21f6a3a fwd=“174.138.37.36” dyno= connect= service= status=503 bytes= protocol=https

---

<div class="post-metadata">

**Author:** ![BenGitter](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/bengitter/32/12192_2.png) [@BenGitter](https://forum.freecodecamp.org/u/BenGitter)\
**Post date:** [January 24, 2018, 11:51am UTC](https://forum.freecodecamp.org/t/node-app-on-heroku-getting-application-error/170632/4 "2018-01-24T11:51:50Z")

</div>

> [@victornice](#):
>
> npm ERR! missing script: start

You need a start script in your package.json file. Something like:

```auto
"scripts": {
    "start": "node server.js"
}

```

---

<div class="post-metadata">

**Author:** ![victornice](https://avatars.discourse-cdn.com/v4/letter/v/3bc359/32.png) [@victornice](https://forum.freecodecamp.org/u/victornice)\
**Post date:** [January 24, 2018, 12:03pm UTC](https://forum.freecodecamp.org/t/node-app-on-heroku-getting-application-error/170632/5 "2018-01-24T12:03:19Z")

</div>

now I’m getting this

2018-01-24T12:02:14.220261+00:00 app[web.1]: npm ERR! Exit status 1  
2018-01-24T12:02:14.221027+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.  
2018-01-24T12:02:14.220561+00:00 app[web.1]: npm ERR!  
2018-01-24T12:02:14.220766+00:00 app[web.1]: npm ERR! Failed at the to-do-app@1.0.0 start script.  
2018-01-24T12:02:14.234884+00:00 app[web.1]:  
2018-01-24T12:02:14.235228+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:  
2018-01-24T12:02:14.235401+00:00 app[web.1]: npm ERR! /app/.npm/\_logs/2018-01-24T12\_02\_14\_222Z-debug.log  
2018-01-24T12:02:14.303238+00:00 heroku[web.1]: Process exited with status 1  
2018-01-24T12:02:14.312646+00:00 heroku[web.1]: State changed from starting to crashed  
2018-01-24T12:02:20.609095+00:00 heroku[router]: at=error code=H10 desc=“App crashed” method=GET path="/" [host=firetodo.herokuapp.com](http://host=firetodo.herokuapp.com) request\_id=968b7a24-2faf-4378-b8ba-9749ec3ee2ea fwd=“197.39.19.110” dyno= connect= service= status=503 bytes= protocol=https  
2018-01-24T12:02:21.884234+00:00 heroku[router]: at=error code=H10 desc=“App crashed” method=GET path="/favicon.ico" [host=firetodo.herokuapp.com](http://host=firetodo.herokuapp.com) request\_id=b30b00c4-aca3-4edc-9105-a46bd3757343 fwd=“197.39.19.110” dyno= connect= service= status=503 bytes= protocol=https

---

<div class="post-metadata">

**Author:** ![BenGitter](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/bengitter/32/12192_2.png) [@BenGitter](https://forum.freecodecamp.org/u/BenGitter)\
**Post date:** [January 24, 2018, 12:05pm UTC](https://forum.freecodecamp.org/t/node-app-on-heroku-getting-application-error/170632/6 "2018-01-24T12:05:38Z")

</div>

Does it work locally when you run `npm start`? And what does your package.json look like now?

---

<div class="post-metadata">

**Author:** ![victornice](https://avatars.discourse-cdn.com/v4/letter/v/3bc359/32.png) [@victornice](https://forum.freecodecamp.org/u/victornice)\
**Post date:** [January 24, 2018, 12:12pm UTC](https://forum.freecodecamp.org/t/node-app-on-heroku-getting-application-error/170632/7 "2018-01-24T12:12:07Z")

</div>

Yes, it works locally, and this is my package.json content:

{  
“name”: “to-do-app”,  
“version”: “1.0.0”,  
“description”: “Simple To-Do App”,  
“main”: “app.js”,  
“scripts”: {  
“start”: “node server.js”  
},  
“author”: “wael”,  
“license”: “ISC”,  
“dependencies”: {  
“body-parser”: “^1.18.2”,  
“ejs”: “^2.5.7”,  
“express”: “^4.16.2”,  
“mongoose”: “^5.0.1”  
}  
}

---

<div class="post-metadata">

**Author:** ![BenGitter](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/bengitter/32/12192_2.png) [@BenGitter](https://forum.freecodecamp.org/u/BenGitter)\
**Post date:** [January 24, 2018, 12:16pm UTC](https://forum.freecodecamp.org/t/node-app-on-heroku-getting-application-error/170632/8 "2018-01-24T12:16:26Z")

</div>

> [@victornice](#):
>
> “main”: “app.js”,

If you named your main file `app.js`, you should also use `node app.js` inside the start script.

---

<div class="post-metadata">

**Author:** ![victornice](https://avatars.discourse-cdn.com/v4/letter/v/3bc359/32.png) [@victornice](https://forum.freecodecamp.org/u/victornice)\
**Post date:** [January 24, 2018, 12:20pm UTC](https://forum.freecodecamp.org/t/node-app-on-heroku-getting-application-error/170632/9 "2018-01-24T12:20:30Z")

</div>

Good we are getting close to solve it, now I’m getting this:

2018-01-24T12:19:06.563946+00:00 heroku[web.1]: State changed from crashed to starting  
2018-01-24T12:19:09.001583+00:00 heroku[web.1]: Starting process with command `npm start`  
2018-01-24T12:19:11.473433+00:00 app[web.1]:  
2018-01-24T12:19:11.473449+00:00 app[web.1]: \> to-do-app@1.0.0 start /app  
2018-01-24T12:19:11.473451+00:00 app[web.1]: \> node app.js  
2018-01-24T12:19:11.473452+00:00 app[web.1]:  
2018-01-24T12:19:12.385281+00:00 heroku[web.1]: State changed from starting to up  
2018-01-24T12:19:12.291926+00:00 app[web.1]: Express server listening on port 3900 in production mode  
2018-01-24T12:19:13.578005+00:00 heroku[router]: at=info method=GET path="/" [host=firetodo.herokuapp.com](http://host=firetodo.herokuapp.com) request\_id=bb55228c-ca57-4e30-bf87-be53aa1a6d8c fwd=“197.39.19.110” dyno=web.1 connect=0ms service=60ms status=404 bytes=383 protocol=https  
2018-01-24T12:19:14.885440+00:00 heroku[router]: at=info method=GET path="/favicon.ico" [host=firetodo.herokuapp.com](http://host=firetodo.herokuapp.com) request\_id=64b16bb7-8a7f-4583-ab4c-0a4243c2445a fwd=“197.39.19.110” dyno=web.1 connect=0ms service=4ms status=404 bytes=394 protocol=https  
2018-01-24T12:19:15.873746+00:00 heroku[router]: at=info method=GET path="/" host=firetodo.herokuapp request\_id=7071c9eb-d275-48d6-ba1c-46d6fb0604ef fwd=“197.39.19.110” dyno=web.1 connect=0ms service=10ms status=404 bytes=383 protocol=https

---

<div class="post-metadata">

**Author:** ![BenGitter](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/bengitter/32/12192_2.png) [@BenGitter](https://forum.freecodecamp.org/u/BenGitter)\
**Post date:** [January 24, 2018, 12:22pm UTC](https://forum.freecodecamp.org/t/node-app-on-heroku-getting-application-error/170632/10 "2018-01-24T12:22:41Z")

</div>

Well, it is working then, right?

---

<div class="post-metadata">

**Author:** ![victornice](https://avatars.discourse-cdn.com/v4/letter/v/3bc359/32.png) [@victornice](https://forum.freecodecamp.org/u/victornice)\
**Post date:** [January 24, 2018, 12:24pm UTC](https://forum.freecodecamp.org/t/node-app-on-heroku-getting-application-error/170632/11 "2018-01-24T12:24:37Z")

</div>

no now it says: "Cannot GET / " when I go to the app link

[https://firetodo.herokuapp.com/](https://firetodo.herokuapp.com/)

---

<div class="post-metadata">

**Author:** ![BenGitter](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/bengitter/32/12192_2.png) [@BenGitter](https://forum.freecodecamp.org/u/BenGitter)\
**Post date:** [January 24, 2018, 12:26pm UTC](https://forum.freecodecamp.org/t/node-app-on-heroku-getting-application-error/170632/12 "2018-01-24T12:26:37Z")

</div>

I would have to see the code, do you have it on GitHub or somewhere online?

---

<div class="post-metadata">

**Author:** ![victornice](https://avatars.discourse-cdn.com/v4/letter/v/3bc359/32.png) [@victornice](https://forum.freecodecamp.org/u/victornice)\
**Post date:** [January 24, 2018, 12:32pm UTC](https://forum.freecodecamp.org/t/node-app-on-heroku-getting-application-error/170632/13 "2018-01-24T12:32:16Z")

</div>

> **[waelahmed-dev/todo](https://github.com/waelahmed-dev/todo)**
>
> Contribute to waelahmed-dev/todo development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![BenGitter](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/bengitter/32/12192_2.png) [@BenGitter](https://forum.freecodecamp.org/u/BenGitter)\
**Post date:** [January 24, 2018, 12:35pm UTC](https://forum.freecodecamp.org/t/node-app-on-heroku-getting-application-error/170632/14 "2018-01-24T12:35:56Z")

</div>

You don’t specify what to do on specific routes. You only use `./public` as static folder and set `ejs` as view engine.

And that is working. Try going to `/assets/logo.png` (a file in your static folder) or to `/todo` (a view).

---

<div class="post-metadata">

**Author:** ![victornice](https://avatars.discourse-cdn.com/v4/letter/v/3bc359/32.png) [@victornice](https://forum.freecodecamp.org/u/victornice)\
**Post date:** [January 24, 2018, 12:40pm UTC](https://forum.freecodecamp.org/t/node-app-on-heroku-getting-application-error/170632/15 "2018-01-24T12:40:36Z")

</div>

I can’t understand what should I do now? Can you explain more?

---

<div class="post-metadata">

**Author:** ![BenGitter](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/bengitter/32/12192_2.png) [@BenGitter](https://forum.freecodecamp.org/u/BenGitter)\
**Post date:** [January 24, 2018, 12:44pm UTC](https://forum.freecodecamp.org/t/node-app-on-heroku-getting-application-error/170632/16 "2018-01-24T12:44:42Z")

</div>

You only have this `get` route: `app.get('/todo', function(req, res)`. So only when you go to `/todo` your express server will actually do something. If you want to always render the todo view you can use: `app.get('*', function(req, res)`

Or if you only want `/` and `/todo` to render the todo view, you can add this route:

```auto
app.get('/', function(req, res){
   res.redirect('/todo');
});

```

---

<div class="post-metadata">

**Author:** ![victornice](https://avatars.discourse-cdn.com/v4/letter/v/3bc359/32.png) [@victornice](https://forum.freecodecamp.org/u/victornice)\
**Post date:** [January 24, 2018, 12:48pm UTC](https://forum.freecodecamp.org/t/node-app-on-heroku-getting-application-error/170632/17 "2018-01-24T12:48:22Z")

</div>

Oh my god it worked !!! thank you very much for your tips

---

<div class="post-metadata">

**Author:** ![user096](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/user096/32/132252_2.png) [@user096](https://forum.freecodecamp.org/u/user096)\
**Post date:** [January 25, 2020, 6:48am UTC](https://forum.freecodecamp.org/t/node-app-on-heroku-getting-application-error/170632/18 "2020-01-25T06:48:36Z")

</div>

my heroku bot wasnt working. this is whats its end up.

````auto
Application Logs

2020-01-25T06:44:23.822533+00:00 app[web.1]: npm ERR! errno 1

2020-01-25T06:44:23.823548+00:00 app[web.1]: npm ERR! bot096@1.0.0 start: `node index.js`

2020-01-25T06:44:23.823682+00:00 app[web.1]: npm ERR! Exit status 1

2020-01-25T06:44:23.823870+00:00 app[web.1]: npm ERR! 

2020-01-25T06:44:23.824012+00:00 app[web.1]: npm ERR! Failed at the bot096@1.0.0 start script.

2020-01-25T06:44:23.824090+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

2020-01-25T06:44:23.832177+00:00 app[web.1]: 

2020-01-25T06:44:23.832315+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:

2020-01-25T06:44:23.832411+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2020-01-25T06_44_23_824Z-debug.log

2020-01-25T06:44:23.898784+00:00 heroku[web.1]: Process exited with status 1

2020-01-25T06:44:41.187627+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=bot096.herokuapp.com request_id=efe995cb-eeaa-4d07-8439-3f47fcc8c124 fwd="150.107.175.152" dyno= connect= service= status=503 bytes= protocol=https

2020-01-25T06:45:10.853502+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=bot096.herokuapp.com request_id=023561bb-2e6a-402b-931a-2ad82de2d2d5 fwd="150.107.175.152" dyno= connect= service= status=503 bytes= protocol=https

2020-01-25T06:45:11.507769+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=bot096.herokuapp.com request_id=593e5e66-0c70-4ebd-b423-f14c3f94b298 fwd="150.107.175.152" dyno= connect= service= status=503 bytes= protocol=https```
````

---

<div class="post-metadata">

**Author:** ![chinedu16](https://avatars.discourse-cdn.com/v4/letter/c/58956e/32.png) [@chinedu16](https://forum.freecodecamp.org/u/chinedu16)\
**Post date:** [February 14, 2020, 6:39am UTC](https://forum.freecodecamp.org/t/node-app-on-heroku-getting-application-error/170632/19 "2020-02-14T06:39:00Z")

</div>

1. Include a Server.js File on the root directory of your project

2. Copy and paste  
`var express = require('express')`  
`var path = require('path')`  
`var serveStatic = require('serve-static')`

3. Add this to your script `"start": "node server.js",`

4. Push to heroku

---

<div class="post-metadata">

**Author:** ![mrcuteking](https://avatars.discourse-cdn.com/v4/letter/m/e36b37/32.png) [@mrcuteking](https://forum.freecodecamp.org/u/mrcuteking)\
**Post date:** [April 20, 2020, 10:58pm UTC](https://forum.freecodecamp.org/t/node-app-on-heroku-getting-application-error/170632/20 "2020-04-20T22:58:03Z")

</div>

please I am still facing the same challenge

 ![heroku problem](https://global.discourse-cdn.com/freecodecamp/original/3X/1/5/1551d1c218b803220db017f68a51c7be585f6053.png)

please I need help.

Every time I try to deploy either my database or my server I still get this response. Please help.

[Next page](https://forum.freecodecamp.org/t/node-app-on-heroku-getting-application-error/170632.md?page=2)
