21+ years in hosting · Jaipur, India · INR billing with 18% GST · 24/7 email support
Blog · WebJi® India

How to Install Node.js on cPanel

Quick answer

On cPanel you run Node.js apps rather than install Node yourself: open Setup Node.js App or Application Manager, choose an installed Node version, set the app root, URL and startup file, upload your code and run NPM Install. Keep app.listen() in your code; Passenger assigns the real port.

For developers putting an Express or other Node.js app on cPanel shared or reseller hosting without a VPS.

✓ In business since 2005
✓ INR + GST billing
✓ 24/7 Email Support — avg reply < 60 min
GuideWebJi®
knowledge
Read time
5 min
Sections
7
Updated
14 Nov 2026
Written by
WebJi® team

What installing Node.js on cPanel actually means

On cPanel hosting you do not install Node.js yourself: the host installs one or more Node.js runtimes, and you register an application that runs on one of them through Phusion Passenger, which connects it to your domain on ports 80 and 443. Which screen you use depends on the server.

Node.js tools you may see in cPanel
InterfaceWhereTypical on
Setup Node.js App (Node.js Selector)cPanel → SoftwareCloudLinux servers
Application ManagercPanel → SoftwareStandard cPanel with EasyApache 4 Passenger packages
Web AppscPanel Meridian theme (cPanel & WHM 138+)Newer cPanel versions
WHM → EasyApache 4Root/WHM onlyVPS owners installing ea-nodejs packages

If none of these appear, Node.js support is not enabled for your account; only the host can add it. Server owners install it in EasyApache 4 with ea-apache24-mod-passenger (or ea-ruby27-mod_passenger on AlmaLinux 8), ea-apache24-mod_env and an ea-nodejs package such as ea-nodejs22.

Write the app normally: Passenger handles the port

Keep the usual app.listen() or server.listen() call; Passenger intercepts it and assigns the real port itself ("reverse port binding"), so the number in your code is ignored in production. cPanel's own example application calls server.listen(3000).

// app.js
const express = require('express');
const app = express();

app.get('/', (req, res) => res.send('Hello from Node.js on cPanel'));

const port = process.env.PORT || 3000;
app.listen(port, () => console.log(`listening on ${port}`));

What you must not do is depend on a fixed port from outside: visitors reach the app through your domain, never :3000. If an app never calls listen() at all, Passenger reports that it did not start listening and the site returns an error.

Create the application in Setup Node.js App

Click Create Application, choose a Node.js version, set the mode to Production, set an application root outside public_html, choose the URL and the startup file, then click Create.

  1. Node.js version: the newest LTS your code supports; Node 20 reached end of life in April 2026, so prefer 22 or later where offered.
  2. Application mode: Production sets NODE_ENV=production.
  3. Application root: a folder such as nodeapp in your home directory.
  4. Application URL: the domain, subdomain or path that should serve the app.
  5. Startup file: app.js, server.js or your entry file.

On Application Manager (non-CloudLinux) servers, you create the folder and app.js yourself, then register the app in Application Manager. Passenger looks for app.js by default; another entry file needs a PassengerStartupFile setting that the host adds.

Upload the code and install dependencies

Upload your project, including package.json and the lock file but not node_modules, into the application root, then click Run NPM Install in the app's settings. Dependencies must be built against the server's Node version, not your laptop's.

# the app's edit screen shows the exact activation command, similar to:
source /home/cpuser/nodevenv/nodeapp/22/bin/activate && cd /home/cpuser/nodeapp

npm ci            # or npm install if there is no lock file
node --check app.js
deactivate

Uploading over SFTP is described in uploading a website by FTP. Shell access through cPanel's Terminal works for these commands if your plan includes it.

Environment variables, restarts and logs

Set secrets such as database URLs and API keys as environment variables in the app's settings, and restart the app after every code, dependency or variable change, because the running process keeps the old values.

  • Restart in Setup Node.js App: the Restart button on the app row.
  • Restart with Passenger directly: create tmp/restart.txt in the application root and touch it after each change: mkdir -p ~/nodeapp/tmp && touch ~/nodeapp/tmp/restart.txt.
  • Logs: output from console.log() and crashes appears in the application's log file or logs folder; check there before changing settings.

Common Node.js errors on cPanel and their fixes

Most first deployments fail on missing dependencies, a crash at startup, the wrong startup file or a route mismatch; the log shows which.

Error messages and fixes
What you seeLikely causeFix
503 or "Web application could not be started"App crashed on load, or never called listen()Read the log, run node --check app.js, restart
Error: Cannot find module 'express'Dependencies not installed in the app environmentRun NPM Install, or npm ci in the activated environment
Cannot GET /pathApp runs but has no route; or the app is mounted at a sub-pathAdd the route, or account for the Application URL prefix
Old code still servedProcess not restartedRestart, or touch tmp/restart.txt
Works on HTTP, not HTTPS (addon domain)SSL include file not created for the appAsk the host to copy the app's Apache include to the SSL config

What cPanel Node.js hosting will not do

Passenger starts your app on demand and can stop idle processes, which suits APIs, server-rendered sites and webhooks but not always-on workers, PM2 clustering, large WebSocket servers or builds that need root-level system libraries.

When you reach that limit, the same code moves to a VPS, where you run Node with systemd or PM2 behind Nginx; deploying Next.js on a VPS shows that setup. For managed Node hosting, see Node.js hosting. On WebJi® cPanel hosting, email support@webji.services with the Node version you need before ordering; support replies 24/7 in Hindi and English.

FAQ

Frequently asked questions

Do I need to remove app.listen() for cPanel?

No. Passenger relies on your app calling listen() and silently replaces the port with its own. Use process.env.PORT || 3000 so the same file also runs on your laptop. Removing the call stops Passenger detecting the app.

Can I run Next.js on cPanel?

A static export works on any hosting. Server-rendered Next.js can run through Passenger with a small custom server file, but builds are memory-hungry and often fail on shared plans. Build locally or in CI and upload the output, or use a VPS.

How do I use a different Node.js version for one app?

In Setup Node.js App, edit the application and choose another installed version, then run NPM Install again so native modules rebuild. Each application can use its own version. Versions not installed on the server must be added by the host.

Can my Node app connect to a MySQL database on the same hosting?

Yes. Create the database and user in cPanel's MySQL Databases, connect to localhost with the prefixed names, and store the credentials as environment variables. Steps are in creating a MySQL database in cPanel.

Checked 15 November 2026 against cPanel's "How to Install a Node.js Application" (modified 20 August 2026) and Phusion Passenger documentation · Reviewed by the WebJi® team, Jaipur.

WebJi® since 2005

Ready to get started with WebJi®?

Join 12,000+ businesses across India and overseas. INR pricing, 18% GST shown before payment and 24/7 email support in Hindi and English — average first reply under 60 minutes.