How to Install Node.js on cPanel
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.
knowledge
- Read time
- 5 min
- Sections
- 7
- Updated
- 14 Nov 2026
- Written by
- WebJi® team
Last editorial update: 14 November 2026.
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.
| Interface | Where | Typical on |
|---|---|---|
| Setup Node.js App (Node.js Selector) | cPanel → Software | CloudLinux servers |
| Application Manager | cPanel → Software | Standard cPanel with EasyApache 4 Passenger packages |
| Web Apps | cPanel Meridian theme (cPanel & WHM 138+) | Newer cPanel versions |
| WHM → EasyApache 4 | Root/WHM only | VPS 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.
- 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.
- Application mode: Production sets
NODE_ENV=production. - Application root: a folder such as
nodeappin your home directory. - Application URL: the domain, subdomain or path that should serve the app.
- Startup file:
app.js,server.jsor 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.txtin 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 orlogsfolder; 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.
| What you see | Likely cause | Fix |
|---|---|---|
| 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 environment | Run NPM Install, or npm ci in the activated environment |
| Cannot GET /path | App runs but has no route; or the app is mounted at a sub-path | Add the route, or account for the Application URL prefix |
| Old code still served | Process not restarted | Restart, or touch tmp/restart.txt |
| Works on HTTP, not HTTPS (addon domain) | SSL include file not created for the app | Ask 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.
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.
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.