Node version 14.0.0 is out

The highlights in this release include improved diagnostics, an upgrade of V8, an experimental Async Local Storage API, hardening of the streams APIs, removal of the Experimental Modules warning, and the removal of some long deprecated APIs.

Reading Time: 2 minutes

Node.js 14 will be the Current release for the next 6 months, and then promoted to Long-term Support (LTS) in October 2020.

What’s new in Node v14

1. V8 Engine upgraded to 8.1

The new version of JavaScript engine bringing performance improvements as well as some new features like:

  • Optional Chaining – which allows accessing the value of a property located deep within a chain of connected objects without the need to expressly validate that each reference in the chain,
  • Nullish Coalescing – a logical operator returning its right-hand side operand when its left-hand side operand is null/undefined (and otherwise returning its left-hand side operand),
    Intl.DisplayNames – providing the consistency of language, region, and script display names translations,
  • Intl.DateTimeFormatcalendar and numberingSystem options enabled.

2. Experimental Web Assembly System Interface

The 14.x release includes an experimental implementation of the Web Assembly System Interface (WASI) in order to provide better performance, cross-platform support, and could drastically simplify usage of native modules.

3. Experimental Async Local Storage API

The numerous attempts to manage context across Async Calls resulted in experimental Async Hooks API being introduced in earlier versions of Node.js. As Async Local Storage was a key use case of Async Hooks API, the 14.x release brings an experimental Async Local storage API.

4. Diagnostic Reporting

The diagnostic report was originally released in v12 as an experimental feature. in v14 it’s been promoted to a stable feature. It provides triggered/on-demand reports containing useful insights about issues occurring on production including but not limited to unexpected errors, crashes, memory leaks, extensive CPU usage etc.

5. API Streams Hardening

Latest release contains numerous changes to Streams implementation aiming to improve consistency across the Streams APIs i.e.:

  • http.OutgoingMessage is similar to stream.Writable
  • net.Socket behaves exactly like stream.Duplex.
  • autoDestroy option is set ‘true’ by default and makes stream always call _destroy after ending

Depreciations

  • crypto: move pbkdf2 without digest to EOL.
  • fs: deprecate closing FileHandle on garbage collection.
  • http: move OutboundMessage.prototype.flush to EOL.
  • lib: move GLOBAL and root aliases to EOL.
  • os: move tmpDir() to EOL.
  • src: remove deprecated wasm type check.
  • stream: move _writableState.buffer to EOL.
  • doc: deprecate process.mainModule.
  • doc: deprecate process.umask() with no arguments.
  • module: remove experimental modules warning.

Upgrade Node using NVM

We can simple upgrade our old version to newer using NVM(node version manager). Run the following command in your terminal:

nvm install 14

It’ll upgrade your node version to v14.0.0 & npm to v6.14.4

References

Comments