Node 15 vs. Node 16

Blog Author

On April 20, 2021, OpenJS released the latest major version of Node.js, Node 16.

With this even-numbered release, we see a few changes to the V8 engine, support for the new Apple Silicon processors, and a stable Timers/Promises API. We can also expect to see long-term support for this version.

High Level Changes

"Even number" vs. "Odd number" releases

As an even-numbered release, Node 16 will have Long-Term Support (LTS) status, which guarantees that critical bugs will be fixed for a total of 30 months. Important to remember with any even Node release is that the previous odd version, Node 15 in this case, is now End of Life (EOL) and is no longer being supported.

It is not recommended that production applications ever run on odd number releases. If your company happens to have a Node 15 application in production, it will stop receiving security patches or bug fixes, and you should upgrade as soon as possible. If your company needs guidance on upgrading quickly, we offer custom software development services and have helped many companies set up maintenance plans to keep their frameworks and packages up to date.

If you're curious to read more about the Node and its Semantic Versioning terminology, the blog NodeSource is a great resource and goes into much more depth on the topic.

For the specific support status dates of all Node versions, the NodeJS release schedule below is the most accurate source of information.

Node JS release schedule

timers/promises API

Starting with version 16.0, the timers/promises API officially moves from experimental to stable. This API simply gives gives a way to define a timer as a Promise object.

import { setTimeout } from "timers/promises"

const main = async () => {
  console.log(new Date().toTimeString())
  await setTimeout(1000)
  console.log(new Date().toTimeString())
}

main()

Running the following example correctly await's the Promise returned from setTimeout, and prints out the following:

16:45:41 GMT-0700 (Pacific Daylight Time)
16:45:42 GMT-0700 (Pacific Daylight Time)

V8 Engine Upgraded to Version 9.0

The V8 JavaScript engine is updated to version 9.0, up from 8.6 in Node 15. With this upgrade comes some performance improvements and the ECMAScript RegExp Match Indices which provide the start and end indices of a string through a new .indices property on certain match objects.

const matchObj = /(Node) (16)/d.exec('Node 16');

Given a match object defined above, we get the following when logging out matchObj.indices, outlining the start and end indices of each match.

[[0, 7], [0, 4], [5, 7], groups: undefined]

Apple Silicon support

In order to support Apple's new Apple Silicon M1 chip, the macOS installer (.pkg) will be shipped as a multi-architecture binary. This means that Node 16 will work on the new M1 Macs.

Breaking Changes

None coming from Node 15.

Conclusion

Node 16 will be supported next 30 months, while simultaneously discontinuing support for Node 15 immediately. This makes this a "must" upgrade for those currently on Node 15, and definitely something to consider coming from Node 14 in order to stay on the current LTS version as long as possible.

If you find yourself stuck on Node 15 or looking for any help with your Node.js application, feel free to contact us for a free consultation.

June 14th, 2021

Take our free DevOps and Cybersecurity Readiness Assessment

Take Our Assessment