BlogNode.js

How to Upgrade Node.js: Version Managers, Installers, Docker and CI

Scott Sternloff

By Scott Sternloff, Senior Enterprise Architect

LinkedIn · Updated · 7 min read

How to Upgrade Node.js: Version Managers, Installers, Docker and CI
On this page

To upgrade Node.js, install the new version with the same tool that installed the old one (nvm or fnm, the nodejs.org installer, a package manager, or a new Docker base image), reinstall dependencies so native addons are rebuilt, run your tests, then update the version pins in .nvmrc, package.json, CI and Dockerfiles. Upgrade to an LTS line: on 11 October 2026 that is Node.js 24, or Node.js 26 once it enters LTS on 28 October 2026.

node -v                                  # what you run now
nvm install --reinstall-packages-from=current 24
nvm alias default 24
rm -rf node_modules && npm ci && npm test

The rest of this post covers each install method, the breaking changes that bite between majors, and rolling the upgrade through CI and production.

Check your current version and install method

Start by finding the version and, more importantly, how it was installed, because upgrading with a different tool leaves two Node.js installs fighting over PATH.

node -v
npm -v
node -p process.versions     # V8, OpenSSL and module ABI versions
which -a node                # Windows: where node

A path under ~/.nvm or fnm's directory means a version manager; /opt/homebrew or /usr/local/Cellar means Homebrew; /usr/bin/node usually means apt or yum; C:\Program Files\nodejs means the Windows installer.

Choose the target version

LineStatus on 11 October 2026Maintenance LTS fromEnd of life
Node.js 26Current; Active LTS from 28 October 202620 October 202730 April 2029
Node.js 24 (Krypton)Active LTS20 October 202630 April 2028
Node.js 22 (Jod)Maintenance LTS21 October 202530 April 2027
Node.js 20 and olderEnd of lifeNode.js 20: 30 April 2026

Odd-numbered lines such as 25 never get LTS, so skip them in production. If you are on 20 or older, Node.js 24 gives you until April 2028; if the upgrade lands after 28 October, Node.js 26 buys another year. Our Node.js end of life post has every date and the cloud runtime deprecations.

Upgrade with nvm, fnm or mise

Version managers install each Node.js version side by side in your home directory, so switching back is one command. nvm (v0.40.8 at the time of writing) is the most common:

nvm ls-remote --lts | tail -3
nvm install --reinstall-packages-from=current 24
nvm alias default 24
node -v

--reinstall-packages-from copies your global npm packages across; without it, globally installed CLIs disappear after the switch. fnm is faster and also reads .nvmrc and .node-version, switching automatically when you set it up with fnm env --use-on-cd:

fnm install 24
fnm default 24

Volta users should note its README now says it is unmaintained and recommends migrating to mise, where the equivalent is mise use node@24.

Upgrade with an installer or package manager

  • Official installer. The macOS and Windows installers from nodejs.org upgrade in place. Pick the LTS download, not Current.
  • Homebrew. brew upgrade node moves you to the newest release, which is Node.js 26 and not yet LTS. To stay on 24, install the versioned formula; it is keg-only, so put it on your path:
brew install node@24
echo 'export PATH="$(brew --prefix node@24)/bin:$PATH"' >> ~/.zshrc
  • Debian and Ubuntu. Distribution packages often lag several majors behind; check apt-cache policy nodejs. NodeSource publishes a repository per major line:
curl -fsSL https://deb.nodesource.com/setup_24.x -o nodesource_setup.sh
sudo -E bash nodesource_setup.sh
sudo apt-get install -y nodejs
  • Windows package managers. winget upgrade OpenJS.NodeJS.LTS, or choco upgrade nodejs-lts with Chocolatey. Open a new terminal afterwards so PATH is reloaded.

Upgrade the Docker base image

In containers the upgrade is the FROM line. Pin the major version and the distribution, because floating tags such as node:lts move to the next major when it becomes LTS:

FROM node:24-bookworm-slim
WORKDIR /app
COPY package*.json ./
RUN npm ci --omit=dev
COPY . .
CMD ["node", "server.js"]

Run npm ci inside the image rather than copying node_modules from a laptop: native addons are compiled for a specific Node.js version and C library, and an Alpine image uses musl rather than glibc. Trixie-based tags such as node:24-trixie-slim also exist if you are moving the OS forward at the same time. AceMQ's Docker support team handles base-image upgrades and image hardening across a fleet.

Pin the version for everyone

Record the new version where every tool will see it:

echo "24" > .nvmrc

// package.json
"engines": { "node": ">=24 <25" }

# GitHub Actions
- uses: actions/setup-node@v7
  with:
    node-version-file: .nvmrc

The engines field is advisory: npm only warns on a mismatch unless engine-strict=true is set in .npmrc. Set it if you want installs on the wrong version to fail.

Breaking-change checklist

  • Native addons. Each major changes the module ABI (NODE_MODULE_VERSION 115 on Node.js 20, 127 on 22, 137 on 24, 147 on 26). An addon built for the old one fails with an error that it was compiled against a different Node.js version. Delete node_modules and run npm ci, or npm rebuild, and check that packages with prebuilt binaries publish builds for the new version.
  • OpenSSL. Node.js 17 moved to OpenSSL 3.0, which rejects some old algorithms and key sizes with ERR_OSSL_EVP_UNSUPPORTED; --openssl-legacy-provider is a temporary workaround, not a fix. Node.js 24 moved to OpenSSL 3.5 in 24.5.0. Test TLS connections to old internal services and anything that signs or hashes.
  • DNS. Also since Node.js 17, dns.lookup() returns addresses in the order the resolver gives them, so localhost can resolve to ::1 and miss a service listening only on 127.0.0.1.
  • npm major. Node.js 20 and 22 ship npm 10; 24 and 26 ship npm 11. Read the npm changelog if CI scripts parse npm output or rely on old flags.
  • Removed APIs. Node.js 24 runtime-deprecates url.parse() and removes tls.createSecurePair; Node.js 25 removed fs.F_OK and its siblings; Node.js 26 removes the deprecated writeHeader() alias in node:http and the legacy _stream_* modules. Run your tests on the current version with --throw-deprecation first to surface deprecated calls.
  • Types and tooling. Move @types/node to the matching major, and upgrade build tools old enough to hit the OpenSSL change.

Rolling it out through CI and production

  1. Add the new version to the CI matrix next to the old one and fix failures until both pass.
  2. Switch the default: .nvmrc, engines, Dockerfiles and serverless runtimes (AWS Lambda offers nodejs24.x and nodejs26.x).
  3. Deploy to staging, then canary a slice of production. Watch memory, garbage-collection pauses, latency and error rates: a new V8 can change all four.
  4. Roll out fully, keep the previous image ready for rollback, then remove the old version from the matrix.

If you cannot upgrade yet

Sometimes the blocker is a vendor SDK, a native module with no new build, or a frozen release. Running an end-of-life line unpatched is the worst option. AceMQ's OSSeva platform backports security fixes, including V8 and libuv CVEs, to Node.js 14, 16, 18 and 20 on a quarterly cadence, delivered as signed Docker images and apt, yum or binary packages, so you can schedule the upgrade instead of rushing it. It is the same patch-or-upgrade trade-off we describe for Spring Boot past end of life; see end-of-life support for the other runtimes we cover.

Sources

Frequently Asked Questions

How do I upgrade Node.js to the latest version?

Use the tool that installed it. With nvm run nvm install --lts; with Homebrew, brew upgrade node; on Windows, winget upgrade OpenJS.NodeJS.LTS; in Docker, change the FROM line. Then delete node_modules, run npm ci and run your tests before updating the version pin.

Which Node.js version should I upgrade to?

An LTS line. On 11 October 2026 Node.js 24 is Active LTS with end of life on 30 April 2028. Node.js 26 becomes Active LTS on 28 October 2026 and is supported until 30 April 2029. Node.js 22 is in maintenance until 30 April 2027, and Node.js 20 and older are end of life.

How do I update Node with nvm?

Run nvm install --reinstall-packages-from=current 24 to install Node.js 24 and carry over your global packages, then nvm alias default 24 so new shells use it. Check with node -v.

Do I need to reinstall node_modules after upgrading Node?

Yes, at least for packages with native addons. Every Node.js major has a new module ABI version, so compiled addons built for the old one fail to load. Deleting node_modules and running npm ci on the new version rebuilds them.

Does upgrading Node.js upgrade npm?

Yes. Each Node.js release bundles an npm version: Node.js 22 ships npm 10, and Node.js 24 and 26 ship npm 11. Version managers and installers put that npm on your path with the new Node.

What if I cannot upgrade off Node.js 18 or 20 yet?

The Node.js project no longer patches them. AceMQ's OSSeva platform backports security fixes, including V8 and libuv CVEs, to Node.js 14, 16, 18 and 20, delivered as signed Docker images and apt, yum or binary packages, while you plan the upgrade.

Scott Sternloff

Author

Scott SternloffSenior Enterprise Architect

Senior Enterprise Architect at AceMQ. Writes the technical coverage here: RabbitMQ, Kafka and Redis architecture, clustering and migrations.

Talk to an engineer

Need a hand with Node.js?

Senior engineers who run it in production. Get a quote or a free consultation, no sales pitch.

Free Consultation

Get Expert Eyes on Your Node.js Environment

Whether you're troubleshooting a production incident, planning a migration, or want a second opinion on your architecture — our team is ready. No pitch, just answers.

Email Us