In April 2021, Node.js released its latest major version, Node.js 16. Code-named Gallium, it became a long-term support (LTS) release in October.
Red Hat recently released a fully supported Node 16 container image. Every Red Hat build of a Node.js release is tested and supported on Red Hat OpenShift and Red Hat Enterprise Linux and is based on a Red Hat Universal Base Image.
Red Hat runtimes are tested and certified against various popular development frameworks and technologies while running on Red Hat OpenShift and RHEL. We are unable to test every possible framework and version, but the specific components, modules, and frameworks supported on Red Hat's build of Node.js can be found on the component details page as per the Node.js module and framework support policies.
Deploy the Node.js 16 container image on OpenShift
You can use the OpenShift command-line tool (oc
) to create a new application like so:
$ oc new-app docker pull registry.access.redhat.com/ubi8/nodejs-16:latest~https://github.com/nodeshift-starters/nodejs-rest-http
$ oc expose svc/nodejs-rest-http
Alternatively, you can use the Nodeshift module to deploy a Node.js application from a local directory:
$ npx nodeshift --dockerImage=registry.access.redhat.com/ubi8/nodejs-16 --expose
Node.js 16 updates
The Node.js 16 release delivers a host of improvements and new features. For instance, the V8 JavaScript engine has been updated to version 9. This provides new language features like ECMAScript RegExp
match indices, which provide the start and end indices of a captured string.
The latest version also includes additional Promise-based APIs, like Timers. Timers can return a Promise
object, which removes the need to use the util.promisify()
function. For example:
import { setTimeout } from 'timers/promises';
async function run() {
await setTimeout(5000);
console.log('Hello, World!');
}
run();
Where to learn more
As you can see, using the Node.js 16 container image on Red Hat OpenShift today is pretty simple. To learn more about the improvements and features in this latest version, check out the official Node.js blog post on the subject.
The Red Hat build of Node.js is available with a subscription to Red Hat Runtimes. For more information on how Red Hat defines support for Node.js modules and frameworks in this build, refer to the Node.js module and framework support policies.
If you want to learn more about what Red Hat is up to on the Node.js front, check out Red Hat Developer's Node.js topic page.
Last updated: September 20, 2023