How to Install and Configure Node.js in cPanel

This guide explains how to set up a Node.js application in cPanel using the Setup Node.js App feature.

Requirements

  • A cPanel account with Node.js Selector enabled.

  • Node.js must be installed on the server (via CloudLinux or server administrator).

  • SSH access (optional but recommended).

If you do not see the Setup Node.js App option in cPanel, contact your hosting provider.

Step 1: Log in to cPanel

  1. Access your cPanel account.

  2. Scroll to the Software section.

  3. Click on Setup Node.js App.

Step 2: Create a New Node.js Application

  1. Click Create Application.

  2. Configure the following:

    • Node.js Version: Select your preferred version.

    • Application Mode: Choose Production (recommended) or Development.

    • Application Root: Set the folder where your app files will be located (e.g., nodeapp).

    • Application URL: Select the domain or subdomain.

    • Application Startup File: Enter the main file name (e.g., app.js or server.js).

  3. Click Create.

Step 3: Upload Application Files

You can upload your Node.js files using:

  • File Manager (cPanel)

  • FTP

  • Git (if repository deployment is used)

Upload all project files inside the Application Root directory.

Step 4: Install NPM Dependencies

After the application is created:

  1. Go back to Setup Node.js App.

  2. Click on your created application.

  3. Click Run NPM Install.

This will install all dependencies listed in your package.json file.

Step 5: Restart the Application

  1. Click Restart from the application management page.

  2. Wait for the process to complete.

  3. Visit your application URL to verify it is working.

Optional: Connect via SSH (Advanced)

If SSH access is enabled:

  1. Connect using SSH.

  2. Navigate to the application root:

    cd ~/nodeapp
  3. Activate the environment (copy the command shown in cPanel under “Enter to virtual environment”).

  4. Run manual commands if needed:

    npm install
    npm start

Troubleshooting

  • Ensure the startup file name matches your main application file.

  • Confirm package.json exists in the application root.

  • Check application logs from cPanel if the app fails to start.

  • Make sure the selected Node.js version matches your project requirement.

Was this article helpful?