Upgrading Node.js
editUpgrading Node.js
editKibana requires a specific Node.js version to run. When running Kibana from source, you must have this version installed locally.
The required version of Node.js is listed in several different files throughout the Kibana source code. These files must be updated when upgrading Node.js:
-
.ci/Dockerfile
- The version is specified in theNODE_VERSION
constant. This is used to pull the relevant image from Docker Hub. Note that Docker Hub can take 24+ hours to be updated with the new images after a new release of Node.js, so if you’re upgrading Node.js in Kibana just after the official Node.js release, you have to check if the new images are present on Docker Hub. If they are not, and the update is urgent, you can skip this file and update it later once Docker Hub has been updated. -
.node-version
-
.nvmrc
-
package.json
- The version is specified in theengines.node
field. -
WORKSPACE.bazel
- The version is specified in thenode_version
property. Besides this property, the list of files undernode_repositories
must be updated along with their respective SHA256 hashes. These can be found on the nodejs.org website. Example for Node.js v16.18.1: https://nodejs.org/dist/v16.18.1/SHASUMS256.txt.asc
See PR #128123 for an example of how the Node.js version has been upgraded previously.
Backporting
editThe following rules are not set in stone. Use best judgement when backporting.
Node.js patch upgrades
editTypically, you want to backport Node.js patch upgrades to all supported release branches that run the same major Node.js version (which currently is all of them, but this might change in the future once Node.js v18 is released and becomes LTS):
-
If upgrading Node.js 16, and the current release is 8.1.x, the main PR should target
main
and be backported to7.17
and8.1
.
Node.js minor upgrades
editTypically, you want to backport Node.js minor upgrades to the next minor Kibana release branch that runs the same major Node.js version:
-
If upgrading Node.js 16, and the current release is 8.1.x, the main PR should target
main
and be backported to7.17
, while leaving the8.1
branch as-is.
Upgrading installed Node.js version
editThe following instructions expect that nvm is used to manage locally installed Node.js versions.
Run the following to install the new Node.js version. Replace <version>
with the desired Node.js version:
nvm install <version>
To get the same global npm modules installed with the new version of Node.js as is currently installed, use the --reinstall-packages-from
command-line argument (optionally replace 16
with the desired source version):
nvm install <version> --reinstall-packages-from=16
If needed, uninstall the old version of Node.js by running the following. Replace <old-version>
with the full version number of the version that should be uninstalled:
nvm uninstall <old-version>
Optionally, tell nvm to always use the "highest" installed Node.js 16 version. Replace 16
if a different major version is desired:
nvm alias default 16
Alternatively, include the full version number at the end to specify a specific default version.