This blog was written by Bethany Griggs, with additional contributions from the Node.js Technical Steering Committee.
We’re excited to announce that Node.js 15 was released today. Node.js 15 replaces Node.js 14 as our ‘current’ release line, with Node.js 14 being promoted to LTS (long-term support) later this month. You can expect new releases of Node.js 15 approximately every two-weeks, keeping you up-to-date with the latest features and changes. As an odd-numbered release line, Node.js 15 will not be promoted to LTS. Please bear this in mind when using Node.js 15 in production deployments — we generally recommend the use of an LTS release line for your production deployments.
To download Node.js v15.0.0, visit: https://nodejs.org/en/download/current/. Similarly, you can find the release post at https://nodejs.org/en/blog/release/v15.0.0, which contains the list of commits included in this release.
Just some of the features delivered in Node.js 15:
- AbortController
- N-API Version 7
- npm 7
- Throw on unhandled rejections
- QUIC (experimental)
- V8 8.6
AbortController
Node.js 15 features an experimental implementation of AbortController
. AbortController
is a global utility class used to signal cancelation in selected Promise-based APIs, based on the AbortController Web API:
const ac = new AbortController();ac.signal.addEventListener('abort', () => console.log('Aborted!'),{ once: true });ac.abort();console.log(ac.signal.aborted); // Prints True
In the above example, the abort event is emitted when ac.abort()
is called. The AbortController
will only trigger the abort
event once. Event listeners attached to the AbortSignal
should use the { once: true }
option (or EventEmitter
API equivalent — once()
) to ensure that the event listener is removed once the abort
event is handled.
For more information refer to the Node.js API documentation for AbortController — https://nodejs.org/docs/latest-v15.x/api/globals.html#globals_class_abortcontroller
N-API 7
While we backport new N-API versions to the other LTS Node.js versions, it’s worth mentioning that N-API 7 is new since the last major release and brings additional methods for working with ArrayBuffers.
npm 7
Node.js 15 comes with a new major release of npm, npm 7. npm 7 comes with many new features — including npm workspaces and a new package-lock.json
format. npm 7 also includes yarn.lock
file support. One of the big changes in npm 7 is that peer dependencies are now installed by default. For more information on the npm 7 release, including details of the breaking changes, check out the GitHub blog.
Throw on unhandled rejections
As of Node.js 15, the default mode for unhandledRejection
is changed to throw
(from warn
). In throw
mode, if an unhandledRejection
hook is not set, the unhandledRejection is raised as an uncaught exception. Users that have an unhandledRejection
hook should see no change in behavior, and it’s still possible to switch modes using the --unhandled-rejections=mode
process flag.
Node.js has emitted an UnhandledPromiseRejectionWarning
by default for many releases and the decision to switch the mode to throw was agreed to based on input from the results of the Node.js User Insights: Unhandled Promise Rejections survey, and finally a Node.js Technical Steering Committee vote. A special thank you to Mary Marchini for driving this decision forwards.
QUIC (experimental)
QUIC is a new UDP-based transport protocol that is the underlying transport protocol for HTTP/3. QUIC features inbuilt security with TLS 1.3, flow control, error correction, connection migration, and multiplexing.
Node.js 15 comes with experimental support QUIC, which can be enabled by compiling Node.js with the --experimental-quic
configuration flag. The Node.js QUIC implementation is exposed by the core net
module:const { createQuicSocket } = require(‘net’);
For more information on QUIC, check out the Node.js documentation — https://nodejs.org/dist/latest-v15.x/docs/api/quic.html
V8 8.6
The V8 JavaScript engine has been updated to V8 8.6 (V8 8.4 is the latest available in Node.js 14). Along with performance tweaks and improvements the V8 update also brings the following language features:
Promise.any()
— MDN (from V8 8.5)AggregateError
— MDN (from V8 8.5)String.prototype.replaceAll()
- MDN (from V8 8.5)- Logical assignment operators
&&=, ||=,
and??=
— MDN (from V8 8.5)
Read more about V8 at their official blog.
Other project news
Aside from adding new features to Node.js, there has been a great focus on improving the contribution process. This year, the project conducted a Node.js Contributors Survey to gather feedback on the contribution process to determine target areas for improvement. There have also been big improvements to our automation and tooling. It’s now possible to kick off CI runs and land commits just by adding a GitHub label, making it easier for collaborators to manage the constant flow of Pull Requests.
Last year was the 10 year anniversary of Node.js and the project has kicked off the Next 10 Years of Node.js effort. The goal of this effort is to reflect on what led to success in the first 10 years of Node.js and set the direction for success in the next 10. The effort has started by looking at the project’s technical values, constituencies, and their needs to set the basis for future discussions. One of the outcomes so far is that we’ve created a Technical Values document to guide our efforts.
Call to Action!
Try out the new Node.js 15 release! We’re always happy to hear your feedback! It’s also worth testing your applications and modules with Node.js 15, to ensure the future compatibility of your project with the latest Node.js features and changes.
Now is also a good time to start planning to upgrade to Node.js 14, which is due to be promoted to LTS next week. Node.js 14 will continue to be supported until April 2023.
Also of note is that Node.js 10 will go End-of-Life in April 2021, so we advise you to start planning to upgrade if you are still using Node.js 10.
For the timeline of Node.js check out the Node.js Release Schedule.
Thank you!
Thank you to everyone who made this release come together, including the many Node.js contributors and collaborators. We’d also like to extend a special thank you to the Node.js Release Working Group for maintaining and producing Node.js releases and the Node.js Build Working Group for keeping the project infrastructure running.
To download Node.js v15.0.0, visit: https://nodejs.org/en/download/current/ . Similarly, you can find the release post at https://nodejs.org/en/blog/release/v15.0.0, which contains the list of commits included in this release.
Note: v15.0.1 is now available which fixes a crypto regression in v15.0.0.