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.
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.
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:
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.