Free 20-minute strategy call with a senior engineer: AI, payments, eLearning or custom software
Engineering

What’s New in Node.js 21 (and What to Use in 2026)

What’s New in Node.js 21

Key takeaways

  • Node.js 21 (October 2023) made fetch and Web Streams stable, moved to V8 11.8 and added an experimental WebSocket client and test runner globs.
  • Node.js 21 was an odd-numbered, non-LTS release and reached end-of-life on 1 June 2024, so it receives no security fixes.
  • At the time of writing, Node.js 26 is the Active LTS line; Node.js 24 and 22 are in Maintenance LTS, with 22 ending on 30 April 2027.
  • Upgrade by pinning one LTS version everywhere, rebuilding native add-ons, reading each major's breaking changes and testing in staging.

Node.js 21, released on 17 October 2023, made fetch and Web Streams stable, upgraded V8 to 11.8, added an experimental built-in WebSocket client and a navigator global, let the test runner accept glob patterns, and introduced the --experimental-default-type flag for running code as ES modules by default. Later 21.x releases added import.meta.dirname, process.loadEnvFile() and util.styleText().

But Node.js 21 was an odd-numbered “Current” release that never became LTS, and it reached end-of-life on 1 June 2024. It gets no security fixes. If you are running it, or reading about it before choosing a version, the practical answer in 2026 is: use an LTS line instead. At the time of writing, Node.js 26 is the Active LTS release and Node.js 24 and 22 are in Maintenance LTS (see the official Node.js releases page). This guide covers what 21 introduced, where those features are now, and how to upgrade.

Node.js 21 at a glance

ItemNode.js 21
First release21.0.0 on 17 October 2023
Release typeOdd-numbered “Current” release, never promoted to LTS
Final release21.7.3 on 10 April 2024
End-of-life1 June 2024
JavaScript engineV8 11.8 (from Chromium 118)
Bundled npm10.2.0 at launch

Dates come from the Node.js Release working group schedule and the 21.0.0 release notes.

What was new in Node.js 21.0

Stable fetch and Web Streams

The browser-style fetch, FormData, Headers, Request, Response and Web Streams APIs moved from experimental to stable. For most HTTP calls you no longer need a third-party client:

const res = await fetch('https://api.example.com/orders', {
  headers: { Authorization: `Bearer ${process.env.API_TOKEN}` },
  signal: AbortSignal.timeout(5000),
});
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const orders = await res.json();

V8 11.8

The engine update brought new JavaScript features, including array grouping (Object.groupBy and Map.groupBy), ArrayBuffer.prototype.transfer and WebAssembly extended-const expressions, as listed in the Node.js 21 announcement.

const byStatus = Object.groupBy(orders, (order) => order.status);
// { paid: [...], pending: [...], refunded: [...] }

Experimental WebSocket client

A browser-compatible WebSocket global was added behind the --experimental-websocket flag. It no longer needs a flag: it has been enabled by default since Node.js 22.

A flag to default to ES modules

--experimental-default-type=module told Node.js to treat ambiguous files (for example .js files with no "type" field in package.json) as ES modules. It was an experiment and has since been removed (in the Node.js 23 line). Its job is now done by automatic syntax detection, which was added as a flag in 21.1.0 and has been on by default since 22.7.0 and 20.19.0 (see the CLI documentation).

Free resource

Upgrade and patching checklist

Want this applied to your project? Our engineers will send it with notes for your stack.

Get it free

Test runner globs, navigator and other changes

  • Test runner globs: node --test **/*.test.js runs every matching test file.
  • navigator global: with navigator.hardwareConcurrency, a small step towards web-compatible code.
  • flush option for fs.writeFile: forces data to be flushed to permanent storage after a successful write.
  • Stricter HTTP parsing: llhttp 9.1 enforces stricter header and chunk rules by default (--insecure-http-parser restores the old behaviour).
  • Removals and deprecations: the globalPreload loader hook was removed in favour of register and initialize; punycode became runtime-deprecated.

Features added later in the 21.x line

Current releases receive new features every few weeks. These arrived during the 21.x line and were also backported to Node.js 20:

FeatureAdded inStatus today
Module syntax detection (--experimental-detect-module)21.1.0, 20.10.0On by default since 22.7.0 and 20.19.0
import.meta.dirname and import.meta.filename21.2.0, 20.11.0Stable since 24.0.0 and 22.16.0
--allow-addons for the permission model21.6.0, 20.12.0Available; the permission model itself is stable since 23.5.0 and 22.13.0
process.loadEnvFile()21.7.0, 20.12.0No longer experimental since 24.10.0 and 22.21.0
util.styleText()21.7.0, 20.12.0Stable since 23.5.0 and 22.13.0
// ESM: no more fileURLToPath(import.meta.url) boilerplate
import { join } from 'node:path';
const configPath = join(import.meta.dirname, 'config.json');

// Load .env without a dependency
process.loadEnvFile(); // reads ./.env

// Coloured terminal output
import { styleText } from 'node:util';
console.log(styleText('green', 'Build passed'));

One correction to many older articles, including an earlier version of this one: the permission model did not arrive in Node.js 21. It was introduced in Node.js 20.0.0 as --experimental-permission, renamed to --permission in Node.js 24, and is now stable.

Is Node.js 21 still supported?

No. Node.js has historically shipped an even-numbered release each April or May that becomes LTS in October, and an odd-numbered release each October that is supported for only about six months. Node.js 21 followed that pattern: Current from October 2023, Maintenance from 1 April 2024 and end-of-life on 1 June 2024. The Node.js project says production applications should use only Active LTS or Maintenance LTS releases.

The schedule is changing. Starting with Node.js 27, there will be one major release a year and every major version will become LTS after a six-month Current phase, preceded by an Alpha phase. Node.js 27 entered Alpha in late October 2026. Until then, the even/odd rule still applies to versions up to 26.

Which Node.js version should you use today?

VersionStatus at the time of writingEnd-of-lifeRecommendation
Node.js 26 (Lithium)Active LTS since 28 October 202630 April 2029New projects and planned upgrades
Node.js 24 (Krypton)Maintenance LTS since 20 October 202630 April 2028Fine for existing apps; plan the move to 26
Node.js 22 (Jod)Maintenance LTS30 April 2027Upgrade within the next few months
Node.js 20 (Iron)End-of-life30 April 2026Upgrade now
Node.js 21, 23, 25End-of-life (odd-numbered)21: 1 June 2024Upgrade now

Dates are from the Release schedule and may change; check it before you plan. Also check your hosting platform (AWS Lambda, Vercel, Azure, Google Cloud and others), which may add support for a new LTS line some weeks after its release.

What changed between Node.js 21 and today’s LTS

If you jump from 21 (or 20) to 26, you pick up three LTS lines’ worth of changes. The highlights, from the official release notes:

  • Node.js 22 (announcement): WebSocket enabled by default, require() of synchronous ES modules (on by default since 22.12.0), node --run for package.json scripts, stable --watch mode, glob and globSync in node:fs, V8 12.4 with Maglev on by default.
  • TypeScript type stripping: Node.js can run .ts files directly by removing type annotations. It is on by default since 22.18.0 and 23.6.0 and stable since 24.12.0 and 25.2.0; it does not type-check, and syntax such as enum needs a build step (see Node.js TypeScript docs).
  • Node.js 24 (release notes): V8 13.6 (Float16Array, explicit resource management, RegExp.escape), npm 11, a global URLPattern, AsyncLocalStorage on AsyncContextFrame, and runtime deprecation of url.parse().
  • Node.js 26 (release notes): the Temporal date and time API enabled by default, V8 14.6 (Map.prototype.getOrInsert(), Iterator.concat()), Undici 8, and removal of the legacy _stream_* modules and http.Server.prototype.writeHeader().

Upgrade checklist: from Node.js 21 (or 20) to an LTS release

StepWhat to do
1. InventoryList every place Node.js runs: servers, containers, serverless functions, CI images, build machines and developer laptops
2. Pin the targetSet .nvmrc or .node-version, the engines field in package.json and your Docker base image to the same LTS version
3. Update dependenciesUpgrade packages with native add-ons (bcrypt, sharp, database drivers) first; they must be rebuilt for the new NODE_MODULE_VERSION
4. Read the breaking changesGo through each major version’s release notes between your version and the target; search your code for deprecated APIs (url.parse(), punycode, _stream_* modules)
5. Run tests with warnings visibleRun your test suite with --trace-deprecation and fix what it reports
6. Test in stagingCompare error rates, memory and response times with production before switching
7. Roll out and keep currentDeploy gradually, then schedule patch updates; LTS lines receive regular security releases
# Switch versions locally with nvm
nvm install 26
nvm use 26
node -v

# Pin it for the team and CI
echo "26" > .nvmrc

# package.json
# "engines": { "node": ">=26" }

# Docker
# FROM node:26-slim

For larger or older applications, especially ones that skipped several versions, upgrade one LTS line at a time (for example 20 to 22, then 22 to 24, then 24 to 26). It is easier to find the cause of a failure when fewer things change at once.

Frequently asked questions

Is Node.js 21 an LTS version?

No. Node.js 21 was an odd-numbered Current release. Odd-numbered releases up to Node.js 25 were never promoted to LTS, and 21 reached end-of-life on 1 June 2024.

What was the biggest change in Node.js 21?

Stable fetch and Web Streams, so HTTP requests no longer need a third-party library. It also upgraded V8 to 11.8, added an experimental WebSocket client and let the test runner accept glob patterns.

Should I upgrade from Node.js 21?

Yes, as soon as you can. It receives no security fixes. Move to an LTS release; at the time of writing that means Node.js 26 for new work, or Node.js 24 if your platform or dependencies do not support 26 yet.

Which Node.js version should I use in 2026?

Use the Active LTS line, Node.js 26 at the time of writing, for new projects. Node.js 24 and 22 are still supported in Maintenance LTS, but 22 reaches end-of-life on 30 April 2027.

Will Node.js keep the odd and even release pattern?

No. From Node.js 27 there will be one major release per year, and every major version will become LTS after its Current phase.

Upgrade your Node.js applications at a fixed price

Vibidsoft upgrades and maintains Node.js applications as fixed-price work, never by the hour. A fixed-price assessment (from $1,500, credited to the work) checks your Node.js versions, dependencies, native add-ons and hosting, and gives you an upgrade plan with a fixed quote. Stalled or legacy back ends can go through Modernize & Rescue (from $5,000), and a care plan keeps runtimes and dependencies patched after the upgrade.

See our Node.js development services, browse more engineering guides, or book a free 20-minute call.

Vibidsoft Engineering Team

Senior engineers who have shipped 450+ projects since 2014 across AI, payments, eCommerce, eLearning and custom software. Every guide is written and reviewed by the people who do the work.

Follow us on LinkedIn · About Vibidsoft

Next step

Talk to an engineer about Modernize & Rescue

Fixed-price upgrades for ageing PHP, Drupal, Magento or hybrid apps, with security patching and a care plan. from $5,000.

  • A 20-minute call with a senior engineer, not a salesperson
  • A written next-step plan within one business day
  • NDA on request
Book a call WhatsApp