Node.js runs JavaScript outside the browser, and npm, which is installed with it, manages the packages your projects depend on. This guide shows the best ways to install both on Windows, macOS and Linux in 2026, how to switch between versions, and how to keep them updated.
Install the current LTS (long-term support) release, not the newest "Current" one. For most developers the best route is a version manager: fnm on Windows, macOS or Linux, or nvm on macOS and Linux. It installs Node.js in your home folder, needs no admin rights for packages, and lets each project use its own version. If you only need one version, the official installer from nodejs.org is fine. npm comes with Node.js; check both with node -v and npm -v.
1. Which version to install
Node.js has released a new major version every six months: even-numbered versions become LTS and receive fixes for about 30 months, while odd-numbered ones are short-lived. The project has discussed changing this cadence, so always check the schedule on nodejs.org.
| 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, becomes LTS in October 2026 | Trying new features |
The LTS line normally moves forward each October. When you deploy, run the same major version on your server as on your computer.
2. Choose an installation method
- Switch versions per project with one command
- Installs in your home folder, so no sudo for global packages
- Easy upgrades: install the new version, then remove the old one
- One version at a time, upgraded by reinstalling
- Global npm installs may need admin rights
- Linux distribution packages are often several versions behind
Pick one method per machine. Mixing an installer, Homebrew and a version manager is the most common cause of "wrong version" confusion.
3. Windows
Option A: fnm (recommended for developers). In PowerShell:
winget install Schniz.fnmThen add fnm to your PowerShell profile so it loads in every new terminal. Open the profile with notepad $PROFILE (create it if asked) and add this line:
fnm env --use-on-cd --shell powershell | Out-String | Invoke-ExpressionOpen a new terminal and install the LTS release:
fnm install --lts
fnm default 24Option B: the official installer. Download the Windows Installer (.msi) for the LTS version from nodejs.org, choose x64 or ARM64 to match your PC, and run it. Or use winget: winget install OpenJS.NodeJS.LTS.
4. macOS
Option A: nvm or fnm. Install nvm with the one-line command in the README at github.com/nvm-sh/nvm (it pins the current release), then open a new terminal:
nvm install --lts
nvm alias default lts/*Or, with Homebrew: brew install fnm, add eval "$(fnm env --use-on-cd)" to ~/.zshrc, then run fnm install --lts.
Option B: the official installer. Download the macOS Installer (.pkg) for the LTS version from nodejs.org. It works on both Apple silicon and Intel Macs.
Homebrew's own brew install node gives the newest release, which may be a Current rather than an LTS version. For the LTS line from Homebrew, use a versioned formula such as brew install node@24 and follow brew's note on adding it to your PATH.
5. Linux
Option A: nvm or fnm works exactly as on macOS and is the best choice on a development machine.
Option B: NodeSource packages give you a current LTS through your system package manager, which suits servers:
# Debian and Ubuntu
curl -fsSL https://deb.nodesource.com/setup_24.x -o nodesource_setup.sh
sudo bash nodesource_setup.sh
sudo apt install -y nodejs
# AlmaLinux, Rocky Linux, RHEL and Fedora
curl -fsSL https://rpm.nodesource.com/setup_24.x -o nodesource_setup.sh
sudo bash nodesource_setup.sh
sudo dnf install -y nodejsDownloading the script first lets you read it before running it with sudo. The plain apt install nodejs or dnf install nodejs from your distribution's own repositories often gives an older release; check node -v if you use it. On AlmaLinux and Rocky Linux 8 and 9, dnf module list nodejs shows which versions the distribution offers.
6. Check the installation
node -v # for example v24.x.x
npm -v # the npm version bundled with that Node.js release
npx -vIf node is "not recognised" or "command not found", close and reopen the terminal. If the version is not the one you expected, run which node (macOS and Linux) or where node (Windows) to see which installation is being picked up.
7. Switch versions per project
Put a .nvmrc or .node-version file in the project folder containing just the major version:
echo "24" > .nvmrcBoth fnm (with --use-on-cd) and nvm (with nvm use) read it, so everyone on the team runs the same version. You can also declare it in package.json with "engines": { "node": ">=24" }.
8. Update and uninstall
- Update Node.js with a version manager:
fnm install --ltsornvm install --lts --reinstall-packages-from=current, then uninstall the old version withfnm uninstall 22ornvm uninstall 22. - Update with an installer or package manager: run the newer installer, or
sudo apt upgrade nodejs/sudo dnf upgrade nodejsafter switching the NodeSource setup script to the new major version. - Update npm alone:
npm install -g npm@latest. Usually it is simpler to let npm update with Node.js. - Uninstall: use Settings › Apps on Windows;
brew uninstall nodefor Homebrew;sudo apt remove nodejsorsudo dnf remove nodejson Linux. For a version manager, uninstall each version, then remove its folder and the line in your shell profile.
9. npm essentials
npm installinstalls dependencies and updatespackage-lock.json. Commit the lock file.npm ciinstalls exactly what the lock file says. Use it in CI and on servers.npm install -D eslintadds a development-only dependency.npm run devruns a script frompackage.json;npm startandnpm testneed norun.npx create-vite@latestruns a tool without installing it globally.npm auditlists known vulnerabilities;npm outdatedshows packages with newer versions.
Avoid sudo npm install -g. If a global install asks for root, switch to a version manager instead. Yarn, pnpm and Bun are alternatives to npm; see the package managers guide.
10. Running your Node.js project on Domain India
- cPanel and DirectAdmin shared hosting run Node.js apps through the control panel's Node.js tool, so you don't install Node.js yourself. When we checked on 23 September 2026, cPanel offered Node.js 20, 22 and 24, and DirectAdmin 14 to 24. See How to deploy a Node.js app on shared hosting.
- App Platform detects and builds Node.js apps automatically from
package.json; you deploy from GitHub with Deploy Now or with a deploy token. See Getting started with the App Platform. - VPS is self-managed with full root access: install Node.js with NodeSource or a version manager, as above.
- 512 MB RAM per app
- 1 vCPU
- 5 GB NVMe SSD
- PostgreSQL Database
Which Node.js version should I install?
The current LTS release. In September 2026 that is Node.js 24. Node.js 22 is still in maintenance, and Node.js 20 and older no longer receive security fixes.
Is npm installed with Node.js?
Yes. Every Node.js installer and version manager includes npm and npx. Check them with npm -v and npx -v.
Should I use nvm or fnm?
Both work well. nvm is the long-standing choice on macOS and Linux. fnm is faster and also runs natively on Windows. Use one version manager per machine.
Why does apt install an old Node.js version?
Distribution repositories keep older, stable versions. Use NodeSource packages or a version manager to get a current LTS release.
Why do I get permission errors with npm install -g?
Node.js was installed system-wide, so global packages go into a folder owned by root. Install Node.js with a version manager instead of running npm with sudo.
Can I run Node.js apps on Domain India hosting?
Yes. cPanel and DirectAdmin shared hosting have a Node.js application tool, the App Platform builds Node.js apps automatically, and a VPS lets you install any version yourself.
Ready to put your Node.js project online? Compare the App Platform, cPanel hosting and VPS plans, or ask us in a support ticket.
Node.js apps are detected and built automatically, with PostgreSQL and free SSL included.
See App Platform plans