How to Update Node.js to the Latest Version (nvm, Windows, macOS, Linux)

Key Takeaways
- ✓Check your version with node -v and npm -v.
- ✓nvm is the easiest way to install, switch and update Node versions.
- ✓Use an LTS release for production; Current is for testing new features.
- ✓Reinstall global packages after switching versions.
Table of Contents
- •How to Update Node.js to the Latest Version (nvm, Windows, macOS, Linux)
- •Check Your Current Version
- •LTS or Current?
- •Method 1: nvm (macOS and Linux, Recommended)
- •How to Update nvm Itself
- •Method 2: Windows
- •Method 3: macOS with Homebrew
- •Method 4: Linux Package Manager
- •Update npm Too
- •After Updating
- •Frequently Asked Questions
- •Host Your Node.js App
How to Update Node.js to the Latest Version (nvm, Windows, macOS, Linux)
Updating Node.js keeps you on supported, patched releases and gives you newer language features. The safest method depends on how Node was installed in the first place, so start by checking that.
Check Your Current Version
node -v
npm -v
which node # macOS/Linux: shows where Node is installed
where node # WindowsIf the path contains .nvm, update with nvm. If it is /usr/bin/node, it came from your Linux package manager. On Windows, a path under Program Files means the official installer.
LTS or Current?
Node.js releases a new major version every six months. Even-numbered versions become LTS (Long-Term Support) and receive fixes for about two and a half years; odd-numbered versions are short-lived. Use the latest LTS for production and check nodejs.org to see which release is LTS right now.
Method 1: nvm (macOS and Linux, Recommended)
nvm (Node Version Manager) installs Node in your home folder and lets you switch versions per project. Install it with the one-line script from the nvm GitHub page, open a new terminal, then:
nvm install --lts # install the latest LTS
nvm use --lts
nvm alias default lts/* # use it in every new terminal
nvm ls # list installed versions
nvm install 24 # install a specific major versionBring your global packages along when you upgrade:
nvm install --lts --reinstall-packages-from=currentHow to Update nvm Itself
nvm has no self-update command. To update it, re-run the install script: the nvm README says the same script both installs and updates nvm.
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.41.0/install.sh | bashv0.41.0 is the latest nvm release (checked on GitHub, 9 November 2026); use the newest version tag from the nvm repository when you run it. Then open a new terminal and check with nvm --version. The Node.js versions you installed with nvm are kept.
If you installed nvm with git, the README also documents a manual upgrade:
(
cd "$NVM_DIR"
git fetch --tags origin
git checkout $(git describe --abbrev=0 --tags --match "v[0-9]*" $(git rev-list --tags --max-count=1))
) && \. "$NVM_DIR/nvm.sh"nvm-windows is a separate project with its own installer. To update it, download the latest installer from its GitHub releases page (v2.0.1 at the time of writing) and run it.
nvm, Node.js and npm are three separate updates: updating nvm changes the version manager; nvm install --lts updates Node.js; npm install -g npm@latest updates npm.
Method 2: Windows
- Installer: download the LTS installer from nodejs.org and run it; it replaces the existing version.
- winget:
winget upgrade OpenJS.NodeJS.LTS(orwinget installif it is not installed yet). - Multiple versions: use nvm-windows, a separate project with similar commands (
nvm install lts,nvm use).
Close and reopen your terminal afterwards, then run node -v.
Method 3: macOS with Homebrew
brew update
brew upgrade nodeHomebrew's node formula tracks the newest release; install a specific LTS line with formulas such as node@22 if you need one.
Method 4: Linux Package Manager
Distribution repositories (for example Ubuntu's apt install nodejs) often ship an older Node.js. For a current LTS on a server, either use nvm or the official NodeSource repository for the major version you want, following the instructions on its GitHub page, then:
sudo apt update
sudo apt install nodejsUpdate npm Too
npm install -g npm@latestAfter Updating
- Delete
node_modulesand runnpm ci(ornpm install) so native modules are rebuilt for the new version. - Pin the version for your project in
package.json("engines") or an.nvmrcfile. - On a server, restart your process manager (
pm2 restart allor your systemd service) so the app actually runs on the new version. - If your app runs in Docker, change the base image tag (for example
node:24-alpine) and rebuild instead; see why use Docker.
If the app sits behind Nginx and stops responding after the update, see fixing 502 Bad Gateway.
Frequently Asked Questions
Is there an nvm self-update command?
No. Re-run the nvm install script for the version you want; it updates nvm in place and keeps your installed Node.js versions.
How do I check my Node.js version?
Run node -v in a terminal. Use npm -v for npm.
Does updating Node.js break my projects?
Usually not between LTS versions, but native modules must be rebuilt. Delete node_modules and reinstall, then run your tests.
Can I have multiple Node.js versions installed?
Yes, with nvm (macOS/Linux) or nvm-windows. Each project can use its own version.
Host Your Node.js App
RackUp IT hosting runs Node.js apps on managed servers with SSL, backups and monitoring included, so a runtime upgrade is a setting, not a weekend.
Unsure Which Cloud Hosting Plan Fits Your Site?
Answer 4 quick diagnostic questions to estimate the server CPU, RAM and storage you need with transparent pricing.
Cloud Infrastructure Engineer.
Related Posts
VPS HostingVultr Alternatives in 2026: VPS Hosting for Developers Compared
Vultr's Regular Performance prices compared with DigitalOcean, Linode, Hetzner and a fixed-plan VPS at the 8 GB size, plus when container hosting fits better.
VPS HostingWhat Is a VPS? Virtual Private Servers Explained
A VPS (virtual private server) is a virtual machine with its own operating system, resources and root access. How it works, uses, and when you need one.
VPS HostingLinode (Akamai) Alternatives in 2026: VPS Hosting Compared
Linode's shared CPU prices from Akamai's own API, compared with DigitalOcean, Vultr and a fixed-plan VPS, plus when container hosting makes more sense.