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.

If you find this did not work, Contact support for further assistance.

Re-save your domain settings in the panel

If your domain is hosted on a VPS or dedicated server, you could also reload HTTP in the panel.

  1. Navigate to the VPS or Dedicated page.
  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?