All You Need To Know About Node v15

What’s New In Node.js v15.0.0?

Node.js v15 — npm 7 support and updated handling of rejection and more

Quick Summary: This blog tells you everything from head to toe about the latest Node.js V15 release. What is NodeJS long-term-support, whether or not you should update to the latest Node.js V15, what’s new in Node.js v15, and the NPM 7. Get your views clear regarding all these questions as we pertain to the minutest detail in this article. Learn about how you can handle errors, rejections, and bugs in the latest update of NodeJS.

Overview

The Node community released Node.js v15 on 20th October as its current release line. Node.js 14 becomes the long term support as the new node releases and latest updates of Node.js v15.0.0 will release every bi-weekly.

Until the time Node.js v15 becomes an LTS, we recommend using Node v14 for your production deployments. To download the latest node update version of NodeJS, visit the official website. You can also find the release post of Node.js 15 at, where you will find the commit list of version 15 release.

Within a month of the Node.js 15 release, many new changes have been made with improvements like NPM current versions, experimental support for QUIC protocol, javascript language features, updated N-API, and much more.

Announcement

As the news hit of the NodeJS V15.0.0 release, the community was pleased with the announcement. However, as an entrepreneur, you should still choose NodeJS V14 for your production applications because there is complete support for version 14.

The long-term support LTS for Node.js V15 will be released in June 2021, so you may use it in the upcoming year. For the time being, you should adhere to Node.js v14.

Amazing Node.js V15 Features

You might be curious to find the unique features and functionality in the new Node V15. Here are all the features and updated edits in the latest version of NodeJS.

❏ AbortController

AbortContoller is an experiment for canceling specific promise-based APIs. It is a global utility class based on the web API. Let us understand through the below example.

Source

The function ac.abort() calls the abort event from the AbortController class only once. The listener linked with the signal should implement the {once: true} option to execute it smoothly. Alternatively, you can set the EventEmitter API to (once).

The cancellation feature has been discussed for a long time now, and finally, the AbortController facilitates it. Though there are only a few promise-APIs that support the abort feature, the list will surely expand in the future.

❏ N-API Version 7

The new N-API version 7 brings new features to work with the ArrayBuffers. So as you backport for your long-term support Node.js, consider this N-API V7.

You can easily support native modules, create and build new modules using the updated NodeJS V15.0.0. Currently, IBM and Red Hat contribute to N-API, and Node 15 supports N-API V7, making the availability of additional array buffers.

NodeJS developers can use the node-addon-api, which is downloaded over 2 million times. There is detailed information and description of the N-API at the API-docs.

❏ npm 7

The latest version of NodeJS 15 comes with an updated version of the Node Package Manager NPM. In this case, it is NPM 7, which comes with the following notable features:

  • New Packages- Two new packages are introduced with the NPM 7, namely, lock.json v2 and support for yarn.lock, which promises reproducible builds. With the presence of the yarn.lock file, you can build the dependency tree using the NPM.
  • Default installation of peer dependencies- NPM 7 smartly looks after the missing peer dependencies and does the needful automatic downloads when required. Earlier, you had to take care of the same on your own.
  • Workspaces- The better-managed workspaces enable handling multiple packages from a single root package. You can start built-in support for managing packages from a root. There was a dire demand and need for this feature in the NodeJS community. With this introduction, there is going to be a heated debate for NPM vs Yarn.

Quick Read: Top NPM Packages, How it Works and What You Can Do with Node.js Covered?

To quickly kick-start with your NPM package workspace, create a hierarchical package.json that forks all other folders and runs commands. Check the below example:

source

You can find the official NPM 7 package information here. Whenever any package is added or removed, the node package manager NPM current version 7 will notify you.

❏ Throw on unhandled rejections

You would get an unhandled promise rejection before the NodeJS V15 anywhere in the promise chain:

source

This error message has prevailed since NodeJS 6.6 release, and it’s been over 6 years, and now with NodeJS V15.0.0 release, there has been an action taken on the depreciation warning.

Henceforth, if this exception will be caught, your application will terminate. Thus, you must be careful and aware of this change as you implement the updated NodeJS v15.

However, you can catch this and more such unhandled rejections by adding the following global handler:

source

As you use a node process manager and the rejection handler, be relieved that your application will restart again after the crash. And yes, mind well, it is essential to let your application crash, because it might be faulty, and the crash prevents it from further errors and bugs.

❏ QUIC (experimental)

NodeJS V15 provides support for the QUIC protocol (HTTP/3). After the 1st HTTP standard in 1996, the 2nd standard HTTP/2 became acceptable in the year 2015. And currently, the NodeJS developers and the entire development community are going head over heels over the HTTP 3 protocol.

Node.js v15.0.0 gives experimental support for the QUIC protocol so that the Node community can stay ahead with the latest standards. As compared to TCP, the QUIC javascript protocol reduces latency, and the TLS encryption is baked in.

Additional QUIC features:

  • Flow Control
  • Error correction
  • Connection Migration
  • TLS 1.3
  • Multiplexing

You can implement the Node.js QUIC protocol using the core net module:

❏ Javascript engine V8 8.6

With Node.js v15 you get an upgrade of the underlying javascript V8 engine from 8.4 to 8.6. This update enables reduced readable code and more new advanced language features.

Here are the logical assignment operators:

The any() function of the Promise class works for accepted promises and the unhandled promise rejections are returned within the AggregrateError class object. Developers can use the replaceAll() function with the String object, as shown:

Node.js 14.x becomes the next LTS version

Since October 2020, NodeJS V14.x has become the long-term-support NodeJS LTS version in its active phase.

It is highly reliable and efficient to use NodeJS V14 for your production implementations. One of the most lucrative and stable features of Node.js 14 is the Diagnostic Report. Consumers are now able to solve their issues speedily thanks to the easily consumable Diagnostic report. Here, when they report a problem with a node process, they quickly get the solution with summarized information.

Soon there will be a NodeJS LTS V14 release with in-built ICU data, which will simplify multiple language deployments.

Should you upgrade to NodeJS V15?

The Node Community has an even-odd strategy for releasing an LTS version of NodeJS. Every even release like NodeJS V10, V12, V14, V16…etc. will go-ahead to become a long-term-support version, whereas the odd versions like V11, V13, V15…. etc., will be short-lived.

Hence, we advise you to stay with the NodeJS V14.x for your production projects, and if you want to experiment with newer projects and releases, then go ahead with upgrading NodeJS V15.

By 1st June 2021, NodeJS V15 will reach its end-of-life, and there will be bug fixes and security updates till April 2023. Read about 24 Best Security Tips. However, the Node community insisted you try the latest Node Js V15 at least once and give your feedback. The reason being the next NodeJS LTS V16 will be based on NodeJs V15, and you must test your application with Node V15 modules.

Conclusion

There are no signs of diminishing fame and popularity of NodeJS, and it is the right time to stay updated with the latest market demands. At Bacancy Technology, we host full-stack NodeJS developers who have experience building scalable, data-intensive, full-fledge, real-time, and enterprise-level applications. Hire Node.js developer from us and keep your back-end updated with the latest Node.js v15.

Originally published at https://www.bacancytechnology.com.

Learn and Adopt new things!! Love Explore knowledge…. Blogger | Thinker #Technical #RoR #Angular #Node #React