> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://help.hodi.host/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# How do I debug a Node.js application?

## Read what your application printed

An application that crashes says why, on its standard output. That output goes to a log file on your account rather than to your browser.

For a project deployed with Hodifly, it is one file per project and per branch:

```
~/logs/hodifly-<project>-<branch>.log
```

Everything your code writes with `console.log` or `console.error` is in there, along with the stack trace of anything that brought the application down. Open it in cPanel > File Manager, or over FTP. It survives deploys and rollbacks, and it is trimmed automatically when it gets large.

Do not confuse it with the **deployment log** (cPanel > Hodifly > your project > the deployment), which covers the build: installing dependencies, compiling. One tells you whether your code was built, the other what it did once it was running.

For an application you set up yourself in **Setup Node.js App**, add the same thing to the `.htaccess` file in the folder the domain points at, giving the full path:

```
PassengerAppLogFile "/home/USER/logs/my-app.log"
```

## Get a fuller error page

By default the error page in the browser is deliberately bare. Passenger can show a detailed one instead, which is useful while you work but must not stay on a live site: add these to the same `.htaccess` file, and take them out afterwards.

```
PassengerAppEnv development
PassengerFriendlyErrorPages on
```

## Split your problem in two

If the cause is still not obvious, create a small "[Hello World](https://help.hodi.host/en/article/how-do-i-create-a-hello-world-application-1wyaf9b/)" application. If it runs, the server is fine and the problem is in your code. If it does not, see "[What should I do if a Node.js application won't start?](https://help.hodi.host/en/article/what-should-i-do-if-a-nodejs-application-wont-start-1ncoa79/)".