The OpenJS Foundation has made Node.js 16 available for everyone now. This latest release has everything from updates to the JS engine, new APIs, enhanced support for Apple Silicon, and much more. You will be deploying some excellent outcomes if relying on Node.js16 for your next project.
In this post, you can read everything about Node.js 16 updated platform support, V8 version 9, and everything else that helps you make the most out of this technology.
What’s New with Node.js 16 Latest Version?
It was recently released on 20 April 2021, and the version will be moved to the LTS status soon. And, by October 2021, it is expected to be promoted to LTS release followed by maintenance till 2024. Once the promotion is done to LTS, the release will be given the codename - Gallium.
Here are fresh features you must definitely look out for:
V8 Upgraded to V8 9.0
Node.js 16 has come with version 9 of the V8 JS Engine with node Js 16. Initially, V8 has lots of new features along with excellent performance improvements between two consecutive releases. V8 JS engine, as we know, is a runtime environment for implementing JS code.
Experienced developers know that they don’t need to stress over the code’s functionality running on different OS, like Linux and macOS. The credit goes to the V8 JS engine that lets JavaScript run seamlessly across multiple platforms.
Node.js v16.0.0 has updated the V8 engine to V8 9.0 up from V8 8.6 in Node.js 15. This update has brought the ECMAScript RegExp Match Indices, which provides the start and end indices of the captured string. You can get access to indices array via the ‘.indices’ property on match objects. And when the regular expression has the /d flag.
> const matchObj = /(Java)(Script)/d.exec('JavaScript'); undefined > matchObj.indices [ [ 0, 10 ], [ 0, 4 ], [ 4, 10 ], groups: undefined ] > matchObj.indices[0]; // Match [ 0, 10 ] > matchObj.indices[1]; // First capture group [ 0, 4 ] > matchObj.indices[2]; // Second capture group [ 4, 10 ] |
New Compiler and Platform Minimums
Node.js offers pre-built binaries for different platforms this time, as for every major release, minimum toolchains are assessed and raised where needed. Node.js latest version will be the first release where pre-built binaries are shipped for Apple Silicon.
For Intel, there are separate tarballs - (darwin-x64) and ARM (darwin-arm64) architectures; the macOS installer (.pkg) is a multi-architecture binary. Besides, the minimum GCC level for building Node.js 16 is now GCC 8.3
Here are some instances of what has been amended to the minimum support:
- AIX platforms to 8.3
- Xcode version to 11
- GCC version for Linux
Simply put, work is carried out to build support for the current Apple M1 architecture, which is entirely new in Node.js latest version. Overall, it will improve the performance of the new Mac hardware. This is because Node.js will run on Apple M1, rather than relying on the Rosetta emulation layer. This latest version of Node.js (v16) is the first-ever version to provide M1 support.
Stable Timers Promises API
Both observability and determination play a role when helping customers figure out the issues in the production. With AsyncLocalStorage API, it is more reliable and easier to turn stables when compared to Async Hooks. Node.js collaborators are working on it, as it is still not found in the latest version of Node.js.
Though that is something significant that professional Node.js developers will experience soon with an inbuilt set of APIs used by numerous packages, like OpenTelemetry, to help the tracing component of Observability in the Node.js apps.
So, as the Timers Promises API offers a substitute set of timers functions that return Promise objects, there is no need to use:
util.promisify().
import { setTimeout } from 'timers/promises';
async function run() {
await setTimeout(5000);
console.log('Hello, World!');
}
run();
Other Latest Features
Every release comes with certain new features, and Node.js 16 brings along such features as well. However, some other features were available in Node.js 15 releases and are somehow relatively new to the runtime.
Some release features, which were available with Node.js 15, and will be in this latest version of Node.js 16 too are:
- Node-API version 8
- Experimental implementation of the standard Web Crypto API
- Node Package Manager (v7.10.0 in Node.js v16.0.0)
- Web platform atob and bota (buffer.atob(data)) and (buffer.btoa(data)) implementations for compatibility with the web platforms APIs.
- Stable AbortController implementation
- Stable Source Maps v3
Deprecations
With the release of this latest version of Node.js16, some new runtime depreciations have also been added. The overall motive is to diminish the disruption to the ecosystem for any breaking changes. Node.js uses CITGM, also known as Canary in the Goldmine, to test the effect of any breaking changes, and that even includes the deprecations. It is tested on many popular ecosystem modules to deliver insight before finally making these changes.
The notable deprecations in Node.js 16 involve the runtime deprecation of process.binding() access for a number of the core modules, including process.binding(‘http_parser’)
Why Node.js16 is Better than Other Versions We Have Used So Far?
Once you upgrade to the older version of Node.js with Node.js 16, you will definitely improve your applications’ performance and quality. Moreover, with this latest version, you are getting access to V8 JavaScript Engine Version 9, New Promises APIs, Updated Platform Support, and certain other features, which you were enjoying with Node.js15. In short, it is a lucrative deal for the programmers to create some fantastic apps for the clients and the users while making easier the entire Node.js app development.
Where to Download this Latest Version of Node.js 16?
Well, it can be easily downloaded
or
Use the Node Version Manager on UNIX to install with nvm install 16.
The Conclusion
This latest version of Node.js or Node.js16 is an outcome of the collective efforts of the many experienced Node.js collaborators, who have managed to offer Node.js developers some amazing features to try on. Expert programmers must surely consider it for their upcoming projects to be more effective and fruitful.
At Your Team In India, we have a pool of certified Node.js engineers. Need help setting up a dedicated team of developers in India? Connect with us our business head now and get a free consultation.