Node.js is a cross-platform, open source, JavaScript-based runtime
A few days ago, the release of the new version of Node.js 21 was announced , a version that highlights updates to the JavaScript engine V8 to 11.8, a new experimental indicator to invert the default values ​​of the module –experimental-default-type, an integrated WebSocket client, many updates to our test runner and more.
With the release of this new Node.js 21.0 branch (which will be supported for 6 months), once the 20.0 branch is stabilized, it will receive LTS status and will be supported until April 2026, while maintenance of the previous LTS branch of Node.js 18.0 will last until September 2025 and the following year (2024) the LTS 16.0 branch will end.
For those who are unaware of the Node.js platform, you should know that it can be used both for maintaining web application servers and for creating regular client and server network programs. To expand the functionality of applications for Node.js, a large collection of modules has been prepared, in which you can find modules with the implementation of servers and clients.
Main new features of Node.js 21
In this new version of Node.js 21, the V8 engine has been updated to version 11.8, used in Chromium 118, which now supports the ArrayBuffer.prototype.transfer method, the ability to group arrays, and WebAssembly instructions for processing constants. The included package manager npm (10.2.0) and the llhttp parser (9.1.2) have also been updated, and support for Visual Studio 2019 and macOS versions prior to 11.0 has been discontinued.
As for the improvements in Node.js 21, one of its main new features is the stabilization of the Fetch API, which is designed to load resources over the network and simplify the writing of universal JavaScript code suitable for working on both the server and client sides.
Another API that has stabilized is the WebStreams API, which provides access to data streams received over the network. This API allows you to add your own controllers that work with data as it arrives over the network, without waiting for the entire file to be downloaded.
In addition, it's worth noting that an experimental mode has been added to use the default JavaScript module implementation ESM instead of CommonJS (specific to Node.js). It's mentioned that this change doesn't affect modules whose format is explicitly defined using the "type" field in package.json; this is specified using the " --input-type " flag. To enable new module configurations, the " --experimental-default-type " flag has been proposed.
Other notable changes in this new version include:
- Added an experimental implementation of the WebSocket API. To enable WebSocket support, the flag “–experimental-websocket«.
- A flush option has been added to the fs.writeFile function to force data to be flushed to the drive after each write operation.
- Improved performance of code related to URL parsing, API retrieval, streams, node:fs, and HTTP.
- Added a global browser object
- In the parameter «-test«, added support for global skins to select tests to run
- Support for the globalPreload handler has been discontinued, in favor of registration and initialization calls to configure modules.
Finally, if you are interested in learning more about this , you can find the details at the following link.
How to install Node.JS on Linux?
For those interested in installing this new version of Node.js, the process is quite simple. Just open a terminal on your system and type one of the following commands , depending on your distribution.
For those who are users of Debian, Ubuntu and derivatives, they only need to type the following:
sudo apt-get update
sudo apt-get install nodejs
sudo apt-get install npm
For those who are users of Arch Linux, Manjaro, Arco Linux, or any other Arch derivative:
sudo pacman -S nodejs npm
For those who use Fedora, RHEL and derivatives:
sudo dnf -i nodejs npm
Finally, another of the methods to install Node.js is from the Snap packages and for this it is enough to execute the following command:
sudo snap install node --classic