Troubleshooting Node.js


This article lists a few steps you can take to troubleshoot your Node.js installation.

The version of Passenger running on DreamHost servers does not currently function with Node.js versions 14+.

Passenger is not using your custom version of Node.js

If you find the custom version you installed is not being used, add the following code to an .htaccess file in your application directory:

PassengerNodejs /home/username/.nvm/versions/node/v12.16.3/bin/node

Make sure to change the username to your Shell user, and version to the version you have installed.

Next, reload Passenger by running the following command in the app's directory:

[server]$ mkdir -p tmp && touch tmp/restart.txt

In the future, you just need to touch the restart.txt file to restart the application.

[server]$ touch tmp/restart.txt

View the following page for further details:

Passenger is not loading the app.js file

If you've followed the instructions in the Enabling Passenger for Node.js article, you have added an app.js file and .htaccess file in your application directory. Make sure your .htaccess file does NOT contain the following line.

PassengerAppType node

This will cause Passenger to not load your app.js file.

Changes to my app are not updating

If you're using Passenger, changes to your app will immediately update. If you find the changes have not updated, you can try the following two options.

touch the restart.txt file

Run the touch tmp/restart.txt command as mentioned in the section above.

Re-save your domain settings in the panel

Shared servers

  1. Navigate to the Hosted Domains page.
  2. Click the Edit link to the right of your domain, under the Web Hosting column.
  3. Scroll down and click the Change settings button to save.
  4. Wait 5 minutes, then view your site.

VPS and dedicated servers

  1. Navigate to the VPS or Dedicated page.
    reload http button
  2. Click the Reload HTTP button.
  3. Wait 5 minutes for it to rebuild the configuration file.

Error logging in Node.js

You can specify custom output and error log locations when launching your Node.js app using the command below. Make sure to change the app name to your app before running the command.

[server]$ node example.js > node_log.log 2> node_error.log

Did this article answer your questions?

Article last updated PST.

Still not finding what you're looking for?