Node.js version

We are using Node 20 with NPM 10 as the default Node version. If you need a different Node and NPM version, update your code repository according to this documentation.

Next upgrade to the Node version is planned for October 2024 when Node 22 will become the LTS version.

ReadyMage provides support for running all LTS releases of Node.js starting Node 14: Node 14 with NPM 6, Node 16 with NPM 8, Node 18 with NPM 10, Node 20 with NPM 10 and Node 22 with NPM 10.

Version mapping looks like this:

Node versionNPM versionYarn version

14

6

1

16

8

1

18

10

1

20

10

1

22

10

1

You can select the Node and NPM versions according to your Magento theme installation and build requirements using one of the following methods:

package.json

By adjusting package.json file engines.node field you can specify the Node version that is required to be used for your theme dependency installation and command execution.

package.json
{
    "name": "theme-name",
    "version": "0.0.1",
    "dependencies": {
        // Insert your dependencies here
    },
    "scripts": {
        // Insert your scripts here
    },
    "engines": {
        "node": "^20.0.0"  // Supports any version of Node 20.x.x
        "node": ">=16.0.0 <=18.0.0"  // Supports Node versions from 16.x.x to 18.0.0
        // The range will prioritize the lowest available version within the specified range
    }
}

General documentation for engines field is available here.

.node-version

We don't recommend using this method of selecting the Node.js version unless you know what you are doing.

example .node-version
v22.3.0

The .node-version file should be located in the same directory as package.json.

.node-version file syntax allows you to specify the exact version that you need.

v22.3.0  // Functional, but non-LTS releases are not recommended.
v22.3    // Functional.
22       // Functional.
20       // Recommended and fully functional.

The advantage of this approach is that you can install any version you want. Not just versions from a provided list. Using a non-LTS version is not recommended.

Priority

Node version defined in .node-version has a higher priority than the one defined in package.json file engines.node field.

Last updated