Node.js 21 is now available!
We’re excited to announce the release of Node.js 21! Highlights include updates of the V8 JavaScript engine to 11.8, stable fetch and WebStreams, a new experimental flag to flip module defaults (–experimental-default-type), a built-in WebSocket client, many updates to our test runner, and more!
Node.js 21 will replace Node.js 20 as our ‘Current’ release line when Node.js 20 enters long-term support (LTS) later this month. As per the release schedule, Node.js 21 will be ‘Current’ release for the next 6 months, until April 2024.
The project continues to make progress across a number of areas, with many new features and fixes flowing into existing LTS releases. For that reason, the changes outlined in the changelog for Node.js 21 only represent a small subset of the features and work since the last major release. This blog post will add some additional context on the larger body of work in relation to those changes.
You can read more about our release policy at https://github.com/nodejs/release.
To download Node.js 21.0.0, visit: </download/current/>. You can find the release post at </blog/release/v21.0.0>, which contains the full list of commits included in this release.
Notable Changes
Stable fetch/WebStreams
The recent update to Node.js, version 21, includes an important change to the fetch module as well as WebStreams. Both modules were marked as stable after a recent update.
This impacts WebStreams, FormData, Headers, Request, Response, and fetch.
Built-in WebSocket client
A experimental browser-compatible WebSocket implementation arises with this release. This is enabled through the flag: –experimental-websocket. As any experimental feature, that’s subject to change.
V8 11.8
As per usual a new version of the V8 engine is included in Node.js (updated to version 11.8, which is part of Chromium 118) bringing improved performance and new language features including:
Array grouping
ArrayBuffer.prototype.transfer
WebAssembly extended-const expressions
Support for globs in the Node.js test runner
With the latest Node.js update, the test runner introduces support for glob expressions when specifying the –test parameter. This means you can now use powerful glob patterns to run tests more efficiently and flexibly. For example, you can execute tests for all files with the .test.js extension across multiple directories using a command like node –test **/*.test.js.