Node.js 21 has already been released and these are its news

Node-js

Node.js is a cross-platform, open source, JavaScript-based runtime

A few days ago the launch of the new version of Node.js 21, version in which the updates of the V8 JavaScript engine to 11.8 stand out, a new experimental indicator to reverse the default values ​​of the –experimental-default-type module, 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 stabilized the 20.0 branch 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 that is presented, the base V8 engine was updated to version 11.8, used in Chromium 118, which now supports the ArrayBuffer.prototype.transfer method, the ability to group arrays, and WebAssembly statements to process constants. They have updated package manager included npm 10.2.0 and llhttp parser 9.1.2 and support for Visual Studio 2019 and macOS versions prior to 11.0 has been discontinued.

Regarding the improvements of Node.js 21, one of its main new features is the Fetch API stabilization, which is designed to load resources over the network and simplify writing universal JavaScript code suitable for working on the server and client side.

Another API that has been stabilized is the WebStreams API, providing access to data streams received over the network. The API allows you to add your own handlers that work with data as the information arrives over the network, without waiting for the entire file to download.

In addition to this, it is also highlighted that it was added an experimental way to use the default implementation of JavaScript ESM modules instead of CommonJS (Node.js specific). It is mentioned that The change does not affect modules whose format is explicitly defined by the "type" field in package.json, it is specified by the flag «–input-type«. To activate new module configurations, the indicator «–experimental-default-type«.

Of the other changes that stand out from this new version:

  • 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 sIf you are interested in knowing more about it, you can check the details in the following link.

How to install Node.JS on Linux?

For those who are interested in being able to install this new version of Node.JS, they should know that the process is quite simple, just They have to open a terminal in the system and in it they are going to type one of the following commands, depending on your distro.

In the case of those who are users of Debian, Ubuntu and derivatives, they just have to type the following:

sudo apt-get update
sudo apt-get install nodejs
sudo apt-get install npm

While for those who are users of Arch Linux, Manjaro, Arco Linux or any other derivative of Arch:

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

Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.