Skip to content

Node.jsDevOps & Git

How to Update Node.js to the Latest Version (Windows, Mac and Linux)

A step-by-step guide to updating Node.js: check your version, choose between LTS and Current, update on Windows (installer, winget, nvm-windows), macOS (nvm, Homebrew) and Linux (nvm, NodeSource), rebuild Docker images, set the version on Render and Vercel, and fix the most common update problems.

MetaSkillGroup

9 min read2

How to update Node.js to the latest version on Windows, Mac and Linux, with a terminal showing node -v and nvm commands

Every few months, Node.js releases a security update, and every developer has the same question: "How do I actually update Node.js on my machine, and on my server?" The answer depends on how you installed it. This guide covers Windows, macOS, Linux, Docker and hosting platforms like Render and Vercel, with the exact commands for each.

💡 Quick answer: Run node -v to see your version. For most projects, install the latest LTS release (in late October 2026 that means Node.js 24.22.1, or 26.x once it becomes LTS). On Windows, use the official installer, winget upgrade OpenJS.NodeJS.LTS or nvm-windows. On macOS and Linux, use nvm (nvm install --lts). In Docker, rebuild with a fresh base image. On hosting platforms, set the version in package.json engines and redeploy. Always run node -v again afterwards and restart your app.

💡 Who is this guide for? Students and developers who use Node.js for React, Next.js, Express or MERN projects and want a safe, step-by-step way to update it.

In this guide:

  1. Why You Should Keep Node.js Updated
  2. Check Your Current Version
  3. Which Version Should You Install?
  4. How to Update Node.js on Windows
  5. How to Update Node.js on macOS
  6. How to Update Node.js on Linux
  7. How to Update Node.js in Docker
  8. How to Set the Node.js Version on Render and Vercel
  9. After You Update: Packages and Tests
  10. Common Problems and Fixes

Why You Should Keep Node.js Updated

  • Security fixes. In October 2026, the Node.js security release fixed 10 vulnerabilities, including the Node2Shell Brotli bug that attackers are now using. Old versions stay vulnerable forever.
  • Package support. New versions of Next.js, Vite and many npm packages drop support for old Node.js lines.
  • Speed and features. Each major version brings a faster JavaScript engine and new built-in features.
  • Fewer "works on my machine" bugs. When everyone on a team uses the same version, builds behave the same way everywhere.

Check Your Current Version

Open a terminal (Command Prompt, PowerShell or Terminal) and run:

bash
1node -v
2npm -v

You will see something like v24.12.0. The first number is the major version (the "line"), and the rest are minor and patch updates.

To see where Node.js is installed, which helps when an update does not seem to work:

bash
1# macOS and Linux
2which node
3
4# Windows
5where node

Which Version Should You Install?

Node.js has two kinds of release lines:

  • LTS (Long-Term Support): even-numbered lines like 22, 24 and 26 that get security fixes for about two and a half years. Use these for real projects.
  • Current: the newest line, with the latest features but a shorter support window. Good for trying new things.

Here is the status in late October 2026:

LineStatusLatest versionEnd of life
26.xCurrent, scheduled to become LTS at the end of October 202626.12.130 April 2029
24.x (Krypton)LTS (maintenance)24.22.130 April 2028
22.x (Jod)LTS (maintenance)22.23.430 April 2027
25.xEnd of life25.9.0Already ended
20.x and olderEnd of lifeNo more fixesAlready ended

Node.js release lines in October 2026: 22 and 24 in long-term support, 26 moving to LTS, and 20 and 25 at end of life

Figure 1: Which Node.js lines are supported in late October 2026. Pick an LTS line for real projects.

Our recommendation: if your project already runs on Node.js 24, update to the latest 24.x. For a new project, choose 24 or 26 LTS. If you are on 20 or older, plan a move to 24 soon, because those versions no longer get any security fixes.

💡 Pro Tip: Updating within the same line (for example 24.12.0 to 24.22.1) is almost always safe, because patch and minor updates do not break your code. Moving to a new major line (22 to 24) is worth a quick test run first.


How to Update Node.js on Windows

You can choose any of these three methods. Use only one, because mixing them causes PATH problems.

Option 1: The official installer (easiest)

  1. Go to nodejs.org and download the LTS Windows installer (.msi).
  2. Run it. It replaces your old version automatically.
  3. Close and reopen your terminal, then run node -v.

Option 2: winget (one command)

Windows 10 and 11 include the winget package manager:

powershell
1winget upgrade OpenJS.NodeJS.LTS

If you installed the Current line instead, use OpenJS.NodeJS.

Option 3: nvm-windows (best if you switch between versions)

NVM for Windows lets you keep several Node.js versions and switch between them, which is handy when different projects need different versions:

powershell
1nvm install 24.22.1
2nvm use 24.22.1
3nvm list

If you install nvm-windows on a machine that already has Node.js, uninstall the old Node.js first from Settings → Apps, so the two do not fight over your PATH.


How to Update Node.js on macOS

With nvm (recommended)

nvm (Node Version Manager) is the most flexible way to manage Node.js on macOS and Linux. Install it using the command in the official nvm GitHub README, then:

bash
1nvm install --lts
2nvm alias default lts/*
3node -v

To install a specific version instead, use nvm install 24.22.1.

With Homebrew

bash
1brew update
2brew upgrade node

Note that Homebrew's node formula follows the Current line. To stay on an LTS line, install the versioned formula, such as brew install node@24, and follow the PATH instructions Homebrew prints at the end.

With the official installer

Download the macOS LTS installer (.pkg) from nodejs.org and run it, just like on Windows.


How to Update Node.js on Linux

With nvm (recommended for development)

bash
1nvm install --lts
2nvm alias default lts/*

nvm installs Node.js inside your home folder, so you never need sudo for global npm packages.

With NodeSource (common on Ubuntu and Debian servers)

The version in Ubuntu's own apt repository is often old. Many servers use the NodeSource repository instead:

bash
1curl -fsSL https://deb.nodesource.com/setup_24.x -o nodesource_setup.sh
2sudo -E bash nodesource_setup.sh
3sudo apt-get install -y nodejs

If NodeSource is already set up on your server, a normal sudo apt update && sudo apt upgrade brings you to the latest patch of your line.

Restart your app

On a server, the update only takes effect after you restart your app:

bash
1pm2 restart all          # if you use PM2
2sudo systemctl restart my-app   # if you use a systemd service

How to Update Node.js in Docker

A Docker image contains its own copy of Node.js, so updating your laptop does not change it. Your Dockerfile decides the version:

dockerfile
1FROM node:24-alpine

To get the latest 24.x, rebuild with a fresh base image and redeploy:

bash
1docker build --pull -t my-app .

For fully repeatable builds, you can pin an exact version, such as FROM node:24.22.1-alpine, and change it on purpose when a new release comes out.

💡 Pro Tip: Restarting an old container does not update Node.js. You must rebuild the image and replace the container.


How to Set the Node.js Version on Render and Vercel

Hosting platforms build your app on their own servers, so they need to be told which Node.js version to use.

Render

Render reads the version from these places, in order:

  1. The NODE_VERSION environment variable in the dashboard
  2. A .node-version file in the repo root
  3. A .nvmrc file in the repo root
  4. The engines field in package.json

Render's documentation warns that an unbounded range such as >=20 always resolves to the newest Node.js release, which may be a different major line than you tested. Always add an upper bound:

json
1{
2  "engines": {
3    "node": ">=24.22.1 <25"
4  }
5}

Vercel

Vercel offers only major lines (24.x is the default, and 22.x is also available) and rolls out patch updates for you, including security fixes. You can choose the line in Project Settings → Build and Deployment → Node.js Version, or set it in package.json:

json
1{
2  "engines": {
3    "node": "24.x"
4  }
5}

On any platform, check the build log for the line that shows the Node.js version actually used, and trigger a new deploy after changing it.


After You Update: Packages and Tests

After a major version change (for example 22 to 24), do a clean install and a test run:

bash
1rm -rf node_modules       # on Windows PowerShell: Remove-Item -Recurse -Force node_modules
2npm ci
3npm test
4npm run build

npm ci installs exactly what your package-lock.json says, so you know any problem comes from the Node.js change and not from new package versions. Packages with native code, such as bcrypt or sharp, are rebuilt for the new version during this step.

Finally, add a .nvmrc file with your version (for example 24.22.1) to your repository, so teammates and tools like nvm pick the same version automatically.


Common Problems and Fixes

ProblemLikely causeFix
node -v still shows the old versionTwo installs, and the old one comes first in PATHRun which node or where node, remove the old install, then reopen the terminal
nvm: command not foundThe terminal was not restarted after installing nvmClose and reopen the terminal, or reload your shell profile
EACCES permission errors with npm install -gNode.js installed system-wide with root ownershipUse nvm, which installs into your home folder
App crashes with a native module error after updatingNative packages were built for the old versionDelete node_modules and run npm ci
Production still runs the old versionDocker image or hosting setting not updatedRebuild with --pull, check engines, redeploy

Final Thoughts

Updating Node.js takes a few minutes once you know your setup: check with node -v, update with the installer, winget, nvm or Homebrew, rebuild Docker images, set engines on your hosting platform, and restart your app. Stay on an LTS line, and treat every Node.js security release as a reminder to repeat these steps.

Managing versions and deployments is everyday work for a backend developer. If you want to practise it on real projects, you can do a free internship at MetaSkillGroup. Our backend development internship is online, open all year and free to apply. It takes about 2 minutes to apply, and your first exam attempt is free.

  • #node.js
  • #update node.js
  • #nvm
  • #node version
  • #nodejs lts
  • #docker
  • #devops
  • #backend

Related posts

❓ FAQs

Run node -v in your terminal. The first number is the major line, for example v24.22.1 is on the 24 line. Use which node on macOS and Linux, or where node on Windows, to see where it is installed.

Use an LTS (Long-Term Support) line for real projects. In late October 2026, Node.js 24.22.1 is the recommended LTS, and Node.js 26 is scheduled to become LTS at the end of October. Node.js 20 and older are end of life.

Download and run the LTS installer from nodejs.org, run winget upgrade OpenJS.NodeJS.LTS, or use nvm-windows with nvm install 24.22.1 and nvm use 24.22.1. Use only one method, then reopen the terminal and run node -v.

With nvm, run nvm install --lts and nvm alias default lts/*. With Homebrew, run brew upgrade node for the Current line, or brew install node@24 to stay on LTS. You can also run the official macOS installer from nodejs.org.

For development, use nvm: nvm install --lts. On servers, many people use the NodeSource repository: download its setup_24.x script, run it with sudo, then sudo apt-get install -y nodejs. Restart your app with PM2 or systemd afterwards.

Updates within the same line, like 24.12.0 to 24.22.1, are almost always safe. Moving to a new major line can need small changes, so delete node_modules, run npm ci, and run your tests and build before deploying.

LTS lines are even-numbered and get security fixes for about two and a half years, so they suit real projects. The Current line has the newest features but a shorter support window, so it is better for experiments.

Usually there are two installs and the old one comes first in your PATH. Find it with which node or where node, remove the old install, and open a new terminal.

On Render, use the NODE_VERSION environment variable, a .node-version or .nvmrc file, or engines in package.json with an upper bound, such as >=24.22.1 <25. On Vercel, choose the major line in Project Settings or set engines to 24.x.

Yes. A Docker image has its own Node.js. Change the FROM line if needed, rebuild with docker build --pull and redeploy. Restarting an old container keeps the old version.

Comments

Join the conversation

Login to post comments and replies

No comments yet. Be the first!

Need it built for you?

Built to the same standard as our client work.

If nothing here fits exactly, tell us what you need — our core developers build it. Requirements call first, a written SRS before any code, and a price agreed up front.