Node.js 20 to 22 to 24 to 26: Upgrade Path, Breaking Changes and a Test Plan

Node 20 is end-of-life. This guide walks the upgrade 20 to 22 to 24 to 26 one step at a time: what each release removed or deprecated, which changes hit Express and Mongoose apps, a grep and deprecation-flag checklist, a CI matrix and a rollout plan.

Cover for the article Node.js 20 to 22 to 24 to 26: Upgrade Path, Breaking Changes and a Test Plan

Move from Node.js 20 to 26 in three tested steps: 20 to 22, 22 to 24, then 24 to 26. Node 20 reached end-of-life on 30 April 2026, so it no longer gets security fixes. Nothing forces you to stop at each line, and you can ship straight to 26 once the work is done, but running your test suite on each step means every failure points at one release's changes. Each step below lists what was removed, deprecated or changed in the official release notes, and what that means for an Express and Mongoose style API. For the dates, support phases and which line to choose today, see Which Node.js version to run in production; this post does not repeat them.

The four lines on 5 November 2026

LineStatusEnd of lifeV8Bundled npmNODE_MODULE_VERSION
20 (20.20.2)End-of-life2026-04-3011.310.8.2115
22 (22.23.4)Maintenance LTS2027-04-3012.410.9.9127
24 (24.22.2)Maintenance LTS2028-04-3013.611.19.1137
26 (26.13.0)Active LTS2029-04-3014.611.20.0147

The dates come from the nodejs/Release schedule.json and the versions from the nodejs.org download index on 5 November 2026. The last column matters for native addons: a compiled .node file built for one value does not load under another, so every step needs a rebuild.

Step 1: Node 20 to 22

The 22.0.0 release notes list few removals and several behaviour changes:

  • require() of ES modules. The 22.0.0 notes added support for requiring synchronous ESM graphs behind a flag, and the 22.12.0 notes say it is "now no longer behind a flag on v22.x". It can still throw ERR_REQUIRE_ASYNC_MODULE if the module or its dependencies use top-level await. Check support with process.features.require_module. This is a feature, but it changes how some CommonJS apps can consume ESM-only packages.
  • Import assertions are dropped. import data from './x.json' assert { type: 'json' } no longer works. Use import attributes (with { type: 'json' }), which the 22.12.0 notes mark stable together with JSON modules.
  • crypto.createCipher and createDecipher are end-of-life. Use the iv variants with a proper key derivation.
  • Runtime deprecations now print warnings: the util.is*() helpers (such as util.isArray; the 23.0.0 notes moved most of them to end-of-life), util.log (also end-of-life in 23), the Hash and Hmac constructors, the fs.Stats constructor and the --trace-atomics-wait flag.
  • Behaviour changes: the default stream highWaterMark was bumped, http preserves raw duplicate headers in writeHead after setHeader calls, and console.assert() treats non-string arguments as separate arguments. Streaming endpoints and anything that sets headers twice deserve a test.
  • V8 12.4 (Maglev enabled on supported architectures), a global WebSocket client, node --run, fs.glob and a stable watch mode. NODE_MODULE_VERSION is 127.

Step 2: Node 22 to 24

The 24.0.0 notes remove or deprecate many old APIs, most of which had been on a deprecation path for years:

  • Removed or end-of-life: tls.createSecurePair (DEP0064), OutgoingMessage _headers and _headerNames (DEP0066), dirent.path (use dirent.parentPath), fs.truncate with a file descriptor, tls.Server.prototype.setOptions and net._setSimultaneousAccepts().
  • Runtime-deprecated: url.parse() (use new URL()), SlowBuffer, fs.F_OK, R_OK, W_OK and X_OK (use fs.constants.F_OK and friends), passing invalid types to fs.existsSync, calling zlib classes or the REPL without new, and passing args to spawn and execFile.
  • AsyncLocalStorage now defaults to AsyncContextFrame. If you carry a request id through logging or a tenant id through your data layer with it, test that the value survives every await, stream and callback boundary you use.
  • Tooling: V8 13.6 (Float16Array, RegExp.escape, explicit resource management), npm 11, Undici 7 behind global fetch(), and URLPattern as a global. The permission flag --experimental-permission became --permission.
  • Test runner: it now waits for subtests automatically, and the promises returned by test() and t.test() were removed. NODE_MODULE_VERSION is 137.

Because Node 22 ships npm 10 and 24 ships npm 11, step 2 is also where newer npm settings become available. Those settings are covered in protecting a Node.js project from npm supply-chain attacks.

Step 3: Node 24 to 26 (including what Node 25 removed)

Node 25 was a Current-only line that never became LTS, and it is end-of-life. Its removals are part of the 24-to-26 jump, so read both sets of notes.

  • Removed in 25: SlowBuffer (end-of-life, DEP0030), fs.F_OK and the other access constants, the fs.rmdir recursive option (use fs.rm), assert.CallTracker, the process multipleResolves event and closing a FileHandle on garbage collection.
  • Corepack is no longer distributed with Node from 25 on. If your build runs corepack enable to provide pnpm or Yarn, provision your package manager another way before the upgrade.
  • Web Storage is enabled by default from 25. In 26, reading the global localStorage without --localstorage-file returns undefined, which matters to SSR code that probes for it.
  • Removed in 26: http.Server.prototype.writeHeader() (use writeHead()), the legacy _stream_wrap, _stream_readable, _stream_writable, _stream_duplex, _stream_transform and _stream_passthrough modules, and the --experimental-transform-types flag. DEP0182 (short GCM authentication tags without an explicit authTagLength) is end-of-life, so pass the tag length when you decrypt AES-GCM data.
  • Runtime-deprecated in 26: module.register(), and DEP0201, DEP0203 and DEP0204 (stream and CryptoKey related).
  • New: the Temporal API is on by default, V8 14.6 and Undici 8. NODE_MODULE_VERSION is 147.

The test plan

1. Inventory before you change anything

List which dependencies declare a Node range, which ones are compiled, and which Node version every environment really uses (local, CI, Docker, host). Update engines and .nvmrc in the same pull request as each step.

find node_modules -name "*.node"          # compiled addons: rebuild or replace for every step
npm query "*" | node -e "
  const pkgs = JSON.parse(require('fs').readFileSync(0, 'utf8'));
  for (const p of pkgs) if (p.engines?.node) console.log(p.name + '@' + p.version, p.engines.node);
" | sort -u

2. Search for removed and deprecated APIs

git grep -nE "createCipher\(|createDecipher\(|assert \{ type" -- "*.js" "*.ts" "*.mjs"
git grep -nE "url\.parse\(|SlowBuffer|fs\.(F|R|W|X)_OK|createSecurePair|\.writeHeader\(|_stream_"
git grep -nE "rmdir\(.*recursive|multipleResolves|CallTracker|dirent\.path|module\.register\("

3. Make Node report what it hits at runtime

The Node.js CLI documents --trace-deprecation ("Print stack traces for deprecations"), --throw-deprecation ("Throw errors for deprecations") and --pending-deprecation, which is off by default and also switchable with NODE_PENDING_DEPRECATION=1. Run your tests with them, because warnings inside dependencies are the ones you will not find with grep:

NODE_OPTIONS=--trace-deprecation npm test      # where does each warning come from?
NODE_OPTIONS=--throw-deprecation npm test      # turn warnings into failures
NODE_PENDING_DEPRECATION=1 npm test            # also show pending deprecations

4. Run CI on the current and the target line

strategy:
  fail-fast: false
  matrix:
    node: [22, 24, 26]   # the line you run today and the lines you are heading to
steps:
  - uses: actions/setup-node@v7   # pin to a commit SHA
    with:
      node-version: ${{ matrix.node }}
      cache: npm
  - run: npm ci   # a fresh install rebuilds native addons for this Node
  - run: npm test

5. Test the areas the changes touch

AreaWhat to testChanged in
Request contextRequest ids and tenant ids still arrive in logs and queries after awaits, streams and callbacks24 (AsyncLocalStorage)
HTTP and streamsDuplicate headers, file downloads and uploads, large responses, backpressure22 (writeHead, highWaterMark), 26 (writeHeader removed)
Crypto and authTokens issued before the upgrade still verify, AES-GCM decrypt passes authTagLength22 (createCipher), 26 (DEP0182)
URLsRoutes and redirects that used url.parse()24 (runtime deprecation)
ES modulesESM-only packages from CommonJS code, JSON imports22 (require(esm), import attributes)
Native addons and imagesClean install, container build, start-up on the real base imageevery step (NODE_MODULE_VERSION)
DatesCode that adds Temporal polyfills or checks for its absence26
Build toolingcorepack enable, test runner scripts, flags in NODE_OPTIONS24 (test runner), 25 (Corepack), 26 (flags)

6. Roll out and watch

Deploy the new line to staging with the exact production image, soak it, and compare error rates, memory and latency against your own baseline from the old line. This post gives no benchmark numbers, because none come from a primary source and your workload decides what matters. Keep the previous image tag deployable so rollback is a redeploy, and change one line per release so you can tell the changes apart. The HTTP status codes reference is handy when you decide which health-check responses should mean "not ready".

Frequently asked questions

Can I go from 20 straight to 26?

Technically yes, and the end state is the same. The stepped path just splits the work: failures appear in the step whose notes explain them. If your test coverage is strong and you have no native addons, a direct jump with the checklist above is reasonable.

Should I stop at 22 or 24?

Treat them as stepping stones. Node 22 reaches end-of-life on 30 April 2027, so landing there means doing the work again within months. Node 24 is a safe place to pause during a change freeze, since it is supported until 30 April 2028.

What about Node 25?

Skip it. It never became LTS and it is end-of-life, so there is no reason to run it in production.

If you would rather hand the upgrade to someone who does it regularly, see my Node.js and Express API development service.

Sources

Potrait

Written by Muhammad Asif

MEAN Stack Developer, Pakpattan, Pakistan. I build Angular SSR front ends and Node.js and MongoDB backends for clients, and write up what I learn shipping them.

Free tools for this topic