Each Node.js major version is supported for about 30 months. Running an end-of-life version means no security fixes, and new packages may refuse to install. This guide shows how to move an app to a newer LTS version with minimal downtime.
Before you start
- Check your current version with
node -v. - Read your framework's release notes for the minimum supported Node.js version.
- Take a backup or snapshot of the app folder. On cPanel, JetBackup keeps daily backups.
- Test the new version on your computer first:
npm ci && npm test && npm run build.
Update with nvm
- Install the new version and reinstall your global packages from the old one:
nvm install 24 --reinstall-packages-from=22 - Make it the default for new shells:
nvm alias default 24 - Rebuild the project's native modules:
cd ~/myapp rm -rf node_modules npm ci - Update PM2's in-memory daemon and restart apps:
pm2 update pm2 restart all - When everything works, remove the old version:
nvm uninstall 22.
Tip: Pin the version per project with an .nvmrc file containing 24. Then nvm use in that folder picks the right version.
Update with NodeSource
NodeSource has one repository per major version, so you switch repository and upgrade.
Ubuntu and Debian
curl -fsSL https://deb.nodesource.com/setup_24.x | sudo -E bash -
sudo apt install -y nodejsAlmaLinux and Rocky Linux
curl -fsSL https://rpm.nodesource.com/setup_24.x | sudo bash -
sudo dnf install -y nodejsThen reinstall modules with npm ci and restart your apps as above.
Change the version in cPanel
- Open cPanel → Software → Setup Node.js App and click the pencil icon next to the app.
- Choose the new version in Node.js version and click Save.
- Click Run NPM Install so modules are built for the new version.
- Click Restart and test your site.
The list of versions is set by the server; see CloudLinux Node.js Selector for details.
Check afterwards
node -vshows the new version (in cPanel, run thesourcecommand from the app screen first).- The app starts without errors in its log.
- Key pages and API calls work.
Troubleshooting
was compiled against a different Node.js version— native modules were built for the old version. Deletenode_modulesand runnpm ci.- PM2 still uses the old version — run
pm2 update, or setinterpreterin the ecosystem file. - Build breaks — roll back by selecting the old version and fix the incompatibility locally.
