Skip to content

Node.js 20 to 24 Migration Guide: What Breaks and Why

Node 20 is end of life and 22 is in Maintenance. Here are the Node 24 breaking changes with exact fixes and a checklist. Node 26 is now LTS too.

· · 13 min read

Updated: November 27, 2026

Table of Node.js 18 to 26 status on November 18, 2026 with end of life dates

Quick Take

Node.js 20 reached end of life on April 30, 2026, so v20 no longer gets security fixes. Node 24 has been in Maintenance LTS since October 20, 2026 and is supported until April 30, 2028, v22 is in Maintenance too, and Node 26 became Active LTS on October 28. The biggest change is `require()` of ES modules: no flag needed from v22.12.0 and v20.19.0, stable in v24.15.0. Hard removals are `crypto.createCipher/createDecipher` and import assertions, while `url.parse()` now prints a deprecation warning. The features worth adopting are a shorter list than the changelog suggests.

Node.js 20 reached end of life on April 30, 2026, v22 has been in Maintenance LTS since October 21, 2025, and v24 moved to Maintenance LTS on October 20, 2026, while Node 26 took over as the Active LTS line on October 28. The biggest change between v20 and v22 is require() behavior for ES modules: v22.0 added experimental support behind --experimental-require-module, the flag stopped being needed in v22.12.0, and the feature is stable from v24.15.0. Files with top-level await still throw ERR_REQUIRE_ASYNC_MODULE. Two hard removals landed in v22: crypto.createCipher() and crypto.createDecipher() are gone (migrate to createCipheriv() with an explicit IV), and so is support for import assertions. New capabilities: native fetch has been stable since v21, fs.glob() and fs.promises.glob() handle basic file patterns natively (stable in v24), TypeScript files run directly without a flag on v24 (no enums or decorators), and the global WebSocket constructor matches the browser API for client connections. When migrating, update @types/node to match your target version.

Node.js follows a predictable LTS schedule, even-numbered versions (18, 20, 22, 24) are Long-Term Support. If you're on v20, its active LTS period ended in October 2024 and its security patches stopped on April 30, 2026. V22 is in Maintenance LTS, and v24 dropped in May 2025 and became the Active LTS line that October. I checked the claims below against the Node.js docs and, where a snippet could run, against Node 20.19.5 and 22.23.2 installed side by side. The monorepo behind this site is a useful test bed for one thing: its default Node is 20.19.5, and Astro 7 refuses to start on it until you switch to v22, which is how this upgrade actually begins here. The changelog is a poor guide to which parts hurt, so this is the short list of what does.

LTS timeline

Both jumps carry breaking changes, and they land in different places: v22 removed crypto.createCipher() and import assertions, while v24 adds runtime deprecation warnings and a few removals of its own. Dates below come from the official schedule, re-read on November 18, 2026.

VersionStatus on Nov 18, 2026Maintenance LTS startsEnd of life
Node.js 18End of lifeOct 18, 2023Apr 30, 2025
Node.js 20End of lifeOct 22, 2024Apr 30, 2026
Node.js 22Maintenance LTSOct 21, 2025Apr 30, 2027
Node.js 24Maintenance LTSOct 20, 2026Apr 30, 2028
Node.js 26Active LTS (since Oct 28, 2026)Oct 20, 2027Apr 30, 2029

V20 stopped receiving security patches on April 30, 2026. That deadline is behind you, so a v20 production server no longer gets Node.js security fixes. The Node.js project shipped a security release on Wednesday, October 21, 2026 for the 26.x, 24.x and 22.x lines (v26.12.1, v24.22.1 and v22.23.4), with HIGH as the highest severity, and its notice says end-of-life versions are always affected by a security release. V20 isn't on that list, because the project no longer patches it.

Update, October 2026: Node.js 25 was a Current-only release with no LTS line, and the schedule ended it on June 1, 2026. Node.js 26 shipped on May 5, 2026 and becomes LTS on October 28, 2026, but the Node.js project says production applications should only use Active LTS or Maintenance LTS releases, so v24 is the target for a migration you're doing today. It has support until April 2028, which leaves no reason to rush to 26. More importantly, the project has announced a new release model: starting with Node.js 27, there will be one major release per year (April), promoted to LTS in October, and every release becomes LTS. If you're mapping out a migration for 2027, plan around that yearly rhythm rather than the six-month cadence this guide originally assumed.

Update, November 18, 2026: the schedule did what it said. Node 26 became Active LTS on October 28 and Node 24 moved to Maintenance LTS on October 20, both confirmed against the Node.js release schedule file today. That changes one line of the advice above: "no reason to rush to 26" was written while 26 was still Current, and it no longer applies as a rule. Moving from 20 or 22 off an end-of-life line is still the urgent part, and 24 remains the smaller jump, but 26 is now a legitimate LTS target and its support runs a year longer. What breaks on the 24 to 26 hop, tested on both versions, is in the Node 24 to 26 migration guide.

require() and ES modules

Module interop refers to how CommonJS require() and ECMAScript Module import syntax cooperate inside the same codebase, and Node.js 20 through 24 change the rules three times. This is the one I'd audit first. Node.js v22.0 introduced experimental support for require() of synchronous ES modules behind the --experimental-require-module flag. According to the Node.js docs, the flag stopped being needed in v23.0.0, v22.12.0 and v20.19.0, so on a current v20 or v22 patch release it just works. The experimental warning went away in v22.13.0, v23.5.0 and v20.19.0, and the docs mark the feature stable from v24.15.0. I ran a two-line check to be sure: on Node 20.19.5 and 22.23.2, require('./utils.mjs') returned the export, and a module with top-level await threw ERR_REQUIRE_ASYNC_MODULE on both.

In practice:

// Node.js 20.18 and earlier, throws ERR_REQUIRE_ESM
const utils = require('./utils.mjs');

// Node.js 20.19+, 22.12+, 23+: works if utils.mjs has no top-level await
const utils = require('./utils.mjs');

The catch: files with top-level await still throw, and the error is clear:

Error [ERR_REQUIRE_ASYNC_MODULE]: require() of an ES Module
that uses top-level await is not supported.

Fix for older v22: On v22.11 and earlier, add --experimental-require-module to your start script while testing. On v20.19+, v22.12+ and v23+, nothing extra is needed. If a dependency breaks because of the new behavior, --no-experimental-require-module switches it off. The shorter --no-require-module is not available everywhere: I ran both on Node 22.23.5, 24.21.0 and 26.10.0, and 22.23.5 answers bad option: --no-require-module (and refuses it in NODE_OPTIONS), while 24.21.0 and 26.10.0 accept it. --no-experimental-require-module worked on all three. With either flag set, require() of an .mjs file throws ERR_REQUIRE_ESM.

Fix for top-level await: Move that logic into an async factory function instead. If you want the module to be require()-able, it can't have top-level await.

TypeScript projects using "module": "NodeNext", check your package.json type field. If it's "type": "module", all .js output is treated as ESM. This is now a feature rather than a problem on v23+, but your team needs to understand it.

crypto.createCipher and createDecipher are removed

These were deprecated since Node.js v10, but a lot of code still uses them. They're gone since v22.0.0, which the deprecations page lists as end-of-life. Key derivation is the process of turning a password into a fixed-length cryptographic key, and createCipher() did this insecurely with MD5, no salt and a static initialization vector. createCipheriv() replaces it by requiring you to supply an explicit initialization vector and a properly derived key, which closes off a class of attacks where two identical plaintexts encrypted with the same password produce identical ciphertext blocks.

// Throws in v22: TypeError: crypto.createCipher is not a function
const cipher = crypto.createCipher('aes192', password);

Fix: Migrate to createCipheriv, which requires an explicit initialization vector. That's the secure version anyway:

import { createCipheriv, createDecipheriv, randomBytes } from 'node:crypto';

const iv = randomBytes(16);
const key = Buffer.from(yourKey, 'hex'); // 32 bytes for AES-256, derived with scrypt or pbkdf2 if you start from a password
const cipher = createCipheriv('aes-256-cbc', key, iv);

Store the IV alongside the ciphertext. You'll need it to decrypt.

The crypto.createCipher API derived the key from a password insecurely. This migration is a breaking change, but it also fixes a real security issue.

Share this Post on X Bluesky

The node: prefix is now the convention

Built-in modules work with or without the node: prefix in v22. But tooling, ESLint's unicorn ruleset, type-checking tools, import analyzers, increasingly expects it. It also eliminates any ambiguity between a built-in and an npm package with the same name. In a monorepo with an internal package scope the risk is easy to picture: an internal package whose name matches a built-in module resolves differently depending on whether the import carries the prefix, and that's a bad thing to debug at upgrade time.

The node: prefix removes ambiguity between Node's built-in modules and same-named npm packages. It is not required in Node.js 22, but the unicorn/prefer-node-protocol rule from eslint-plugin-unicorn will fail CI without it once you enable it.

Share this Post on X Bluesky
// Both work, but node: is the current convention
import fs from 'node:fs/promises';
import path from 'node:path';
import crypto from 'node:crypto';

Is this a breaking change? Not technically, your old imports still work. But if you're adding the unicorn/prefer-node-protocol ESLint rule (which ships in the unicorn plugin's recommended preset), your linter will fail CI until you update them.

Fix: Run a quick sed over your source or use ESLint's --fix flag:

npx eslint src --rule "unicorn/prefer-node-protocol: error" --fix

fs.glob() in place of the glob package

Node.js v22 ships fs.glob() and fs.promises.glob() natively, and the fs docs mark the API stable from v24.0.0. No more glob as a dependency for basic file matching:

import { glob } from 'node:fs/promises';

for await (const file of glob('src/**/*.ts')) {
  console.log(file);
}

// Or collect into array
const files = await Array.fromAsync(glob('src/**/*.ts'));

Array.fromAsync() collects an async iterable into an array, much like toArray() does at the end of a chain of JavaScript iterator helpers.

The npm glob package still works and supports more advanced options. Replace it only after verifying your specific patterns match. Simple **/*.ext patterns work fine natively.

TypeScript type stripping

Node.js v22.6.0 added --experimental-strip-types. The flag stopped being necessary in v22.18.0 (still experimental there), the experimental warning disappeared in v24.3.0, and the docs mark type stripping stable from v24.12.0. Type stripping means the runtime deletes type annotations and replaces them with whitespace, without checking or compiling them, which is why it runs fast but cannot support syntax that has no direct JavaScript equivalent, such as enums or decorators.

# v22.6 to v22.17: the flag is required
node --experimental-strip-types scripts/seed.ts

# v22.18+ and v24: no flag
node src/server.ts

Limitations are real: no decorators, and anything that needs code generation (enum, namespace with runtime code, parameter properties) fails unless you pass --experimental-transform-types. Node also ignores tsconfig.json, so path aliases don't work, and imports need the .ts extension and the type keyword on type-only imports. For scripts without those features it's genuinely useful. This monorepo already leans on it in CI: the secret scan step in the validate workflow runs as node --experimental-strip-types packages/shared/src/security/scan-secrets.ts ., so it needs no pnpm install before it. My guess is that path aliases, not enums, are what stop most projects from doing the same.

For production services that depend on aliases, enums or decorators, tsx or a build step is still the practical choice. For a deeper look at what native TypeScript support actually means, what it handles, what it skips, and when to still reach for ts-node, see Node.js native TypeScript without ts-node.

The built-in WebSocket client

Node.js v22.0.0 turned on a global WebSocket constructor matching the browser API by default (on v20 it sits behind a flag), and it's no longer marked experimental since v22.4.0. No ws package needed for client connections. If a package pulls in ws purely as a client and never opens a server, swapping to the global constructor deletes the dependency outright. That is a small win per package and a real one across a monorepo, because the same transitive tree gets installed once per workspace that asks for it.

Node.js 22 ships a global WebSocket constructor that matches the browser API for outbound client connections. Teams using ws only as a client, not a server, can drop the dependency entirely on v22 and later without changing application code.

Share this Post on X Bluesky
// No npm install ws
const socket = new WebSocket('wss://stream.example.com');

socket.addEventListener('open', () => {
  socket.send(JSON.stringify({ type: 'subscribe', channel: 'prices' }));
});

socket.addEventListener('message', (event) => {
  const data = JSON.parse(event.data);
});

If you use ws only as a WebSocket client (not server), you can remove it for v22+ targets. WebSocket server functionality still requires the ws package.

Smaller changes between v20 and v24

A few smaller changes don't deserve their own section, but each one can fail a build or fill a log. All of them come from the official v22 and v24 changelogs and the deprecations page.

  • Import assertions are gone (v22.0.0). import data from './x.json' assert { type: 'json' } is a syntax error now. The with { type: 'json' } form works from v20.10.0, so you can change it before you upgrade.
  • url.parse() warns (v24.0.0). DEP0169 is an application deprecation: code you wrote prints a warning, code under node_modules doesn't. url.format(urlString) and url.resolve() are covered too, because they call url.parse() internally.
  • tls.createSecurePair is removed (v24.0.0). Use tls.Socket instead. It was deprecated in docs back in v0.11.3, so only very old code still calls it.
  • SlowBuffer now warns at runtime (v24.0.0). Same story: Buffer.allocUnsafeSlow() is the replacement.
  • AsyncLocalStorage runs on AsyncContextFrame by default (v24.0.0). The API is the same, and the release notes call it more efficient, so treat it as something to watch in tracing code rather than a change to make.
  • The test runner waits for subtests (v24.0.0). You no longer have to await them yourself.
  • The permission flag is --permission. It used to be --experimental-permission. The rename came when the docs marked the Permission Model stable, in v22.13.0 and v23.5.0, so it predates v24, but a start script written for v20 still carries the old name.
  • Runtime versions moved. Node 24 ships V8 13.6, npm 11 and Undici 7, up from the V8 11.3 that Node 20 carries.

Migration checklist

Before bumping the Node.js version in your Dockerfile or .nvmrc:

  1. Search for crypto.createCipher and crypto.createDecipher, migrate to createCipheriv
  2. Check dynamic require() of .mjs files, and note whether you're on v22.12+ (no flag needed) or older (needs --experimental-require-module)
  3. Search for url.parse(), migrate to new URL(urlString, baseUrl). It still works on v24, but application code now gets a DEP0169 deprecation warning
  4. Search for import assertions (assert { type: 'json' }), which v22 dropped, and switch to with { type: 'json' }
  5. Update @types/node to match your target: npm install -D @types/node@24
  6. Run your full test suite on v24 in CI before touching prod, and fall back to v22 only to see which jump broke it
  7. Update the engines field in package.json:
{
  "engines": {
    "node": ">=24.0.0"
  }
}

That last step gets skipped constantly. It prevents your package from being accidentally run under an older Node.js by a fresh install on a different machine.

Frequently Asked Questions

Is Node.js 20 still supported?
No. Node.js 20 reached end of life on April 30, 2026, according to the official release schedule. It gets no security fixes, and end-of-life versions are always affected when a security release ships.
Do I need to go through Node.js 22 before upgrading to 24?
You don't have to. Going straight to 24 is fine, and 24 is the better target because 22 entered Maintenance LTS on October 21, 2025. If your test suite fails on 24, running it on 22 shows which of the two jumps broke it.
Should I migrate to Node.js 24 or wait for 26?
Both are LTS now, so it is a judgment call. Node 26 became Active LTS on October 28, 2026 and is supported until April 30, 2029; Node 24 is in Maintenance LTS and supported until April 30, 2028. From 20 or 22, 24 is the smaller jump and everything in this guide applies to it. Pick 26 if you want the longer window and have checked the removals it adds.
Will require() of .mjs files work in Node.js 24?
Yes. According to the Node.js docs, require() of synchronous ES modules stopped needing a flag in v23.0.0, v22.12.0 and v20.19.0, and the feature is marked stable from v24.15.0. If your .mjs file has no top-level await, you can require() it directly in v24. Files with top-level await still throw ERR_REQUIRE_ASYNC_MODULE.
Is TypeScript type stripping safe for production in Node.js 24?
It's stable since v24.12.0 and runs without a flag, but it only erases type annotations. Enums, namespaces with runtime code and parameter properties need --experimental-transform-types, decorators fail, and tsconfig.json is ignored, so path aliases don't work. For scripts and CLI tools it's fine. For services that rely on those features, keep tsx or a build step.
What happened to the glob npm package after fs.glob() landed?
The glob npm package still works and is widely used. Node's native fs.glob() is a reasonable replacement for simple patterns, but the npm package supports more advanced options and is more battle-tested. Drop it only after testing your specific patterns.