Different Node.js projects often need different Node.js versions: an older app may only run on the version it was built for, while a new one wants the latest LTS release. nvm (Node Version Manager) installs several versions side by side in your home folder and lets you switch between them with one command. This guide shows how to install nvm, choose the right version, switch per project, and upgrade or downgrade safely.
Install nvm from its official GitHub README, then run nvm install --lts and nvm alias default lts/* to use the current LTS release everywhere. Put a .nvmrc file in each project and run nvm use to switch to that project's version. In September 2026 the version to use is Node.js 24 (Active LTS); Node.js 22 is in maintenance, and Node.js 20 and older no longer get security fixes. nvm runs on macOS and Linux; on Windows use fnm or the separate nvm-windows project.
1. Understand Node.js versions
Node.js uses semantic versioning: major.minor.patch, for example 24.5.1. A new major version can break existing code; minor and patch releases should not.
Each major version goes through three stages:
- Current: the newest release with the latest features. Short-lived for odd numbers.
- Active LTS (long-term support): an even-numbered release that is recommended for production and receives fixes and security updates.
- Maintenance LTS: only critical fixes and security updates, until it reaches end of life.
| Release line | Status in September 2026 | Use it for |
|---|---|---|
| Node.js 24 | Active LTS | New projects and production |
| Node.js 22 | Maintenance LTS | Existing projects until you upgrade |
| Node.js 20 and older | End of life, no security fixes | Nothing new; upgrade |
| Node.js 26 | Current, due to become LTS in October 2026 | Trying new features |
The schedule changes every year, so check the release page on nodejs.org before you choose.
2. Install nvm
nvm works on macOS and Linux (including WSL on Windows). Install it with the one-line command in the README at github.com/nvm-sh/nvm. The README always shows the current release; copy the command from there rather than from an old tutorial, and read the script first if you prefer.
The installer adds a few lines to your shell profile (~/.bashrc, ~/.zshrc or ~/.profile). Open a new terminal, then check:
command -v nvm # prints "nvm" if it loaded
nvm --versionIf nvm is "not found", make sure the lines the installer added are in the profile file your shell actually reads, then open a new terminal.
nvm itself does not run on native Windows. Use fnm, which works on Windows, macOS and Linux with similar commands, or the separate nvm-windows project, which has its own commands. See installing Node.js and npm on your local machine for the Windows steps.
3. Check what you have
node -v # the active Node.js version
npm -v # the npm bundled with it
nvm ls # versions installed with nvm, and your default
nvm ls-remote --lts # LTS versions available to install
nvm current # the version this terminal is using4. Install and use the LTS version
nvm install --lts # install the latest LTS release
nvm use --lts # use it in this terminal
nvm alias default lts/* # use the latest LTS in every new terminalYou can also install a specific major version by number, which installs its latest patch release:
nvm install 24
nvm use 24npm comes with each Node.js version. To update npm on its own, run npm install -g npm@latest, though it is usually simpler to let npm update with Node.js.
5. Pin a version per project with .nvmrc
Put a .nvmrc file in the root of each project so everyone on the team, and your deployment, uses the same version:
echo "24" > .nvmrc
nvm install # installs the version in .nvmrc if needed
nvm use # switches to itCommit .nvmrc to your repository. You can also declare the requirement in package.json, which many tools and hosts read:
{
"engines": { "node": ">=24" }
}6. Upgrade to a newer version
When you move a project to a new major version:
- Install the new version and bring your global packages.Run
nvm install 24 --reinstall-packages-from=22. - Update the project's pin.Change
.nvmrcand theenginesfield. - Reinstall dependencies.Delete
node_modulesand runnpm ci, so native modules are rebuilt for the new version. - Run your tests and build.For example
npm testandnpm run build. Fix any deprecation warnings. - Change the default and clean up.Run
nvm alias default 24, thennvm uninstall 22once nothing needs it.
7. Downgrade for an older project
Sometimes an old project only works on an older release. Install that version and use it for that project only:
nvm install 18
nvm use 18Keep your default on the current LTS, and switch only inside that project. Treat this as temporary: Node.js 18 and older are end of life and receive no security fixes, so plan to upgrade the project rather than running it in production on an old version.
Don't deploy new work on an end-of-life Node.js version. Use an old version only to run or test legacy code while you upgrade it.
8. Build and run your app
With the right version active, use the scripts defined in package.json:
npm ci # install exactly what package-lock.json says
npm run build # run the project's build script
npm start # start the appRun commands through npm run rather than calling a system path such as /usr/bin/node. A fixed path points at the system Node.js, not the version nvm selected.
9. Running Node.js on Domain India
- cPanel and DirectAdmin shared hosting: you don't need nvm. Node.js apps run through the control panel's Node.js tool, which offers several versions. When we checked on 23 September 2026, cPanel offered Node.js 20, 22 and 24, and DirectAdmin 14 to 24. Choose the same major version as your
.nvmrc. See how to deploy a Node.js app on shared hosting. Jailed SSH is available on request (key login only); tools available inside the jail vary, so ask support before relying on one. - App Platform: Node.js apps are detected and built automatically from
package.json; you deploy with Deploy Now or a deploy token. See getting started with the App Platform. - VPS: self-managed with root access. nvm works for your own user; for a service that starts at boot, a system-wide install from NodeSource is often simpler.
- 512 MB RAM per app
- 1 vCPU
- 5 GB NVMe SSD
- PostgreSQL Database
The price on the card is a Domain India list price and excludes 18% GST.
Frequently asked questions
What is nvm?
nvm (Node Version Manager) is a command-line tool for macOS and Linux that installs several Node.js versions in your home folder and switches between them with commands such as nvm install and nvm use.
How do I install the latest LTS version of Node.js with nvm?
Run nvm install --lts, then nvm alias default lts/* so every new terminal uses it. Check the result with node -v.
Which Node.js version should I use in 2026?
The current LTS release. In September 2026 that is Node.js 24. Node.js 22 is in maintenance, and Node.js 20 and older no longer receive security fixes.
How do I make a project always use the same Node.js version?
Add a .nvmrc file with the version number to the project root, commit it, and run nvm use in the project folder. You can also set the engines field in package.json.
Does nvm work on Windows?
Not natively. Use fnm, which runs on Windows, macOS and Linux, or the separate nvm-windows project. nvm does work inside WSL.
Do I need nvm on Domain India shared hosting?
No. cPanel and DirectAdmin shared hosting provide a Node.js tool in the control panel where you choose the Node.js version for each app.
Ready to deploy? Put your Node.js app on the App Platform, compare cPanel hosting and VPS plans, or open a ticket if you need help choosing.
Node.js apps are detected and built automatically, with PostgreSQL and free SSL included.
See App Platform plans