# Node.js version

{% hint style="info" %}
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.
{% endhint %}

ReadyMage provides support for running all LTS releases of Node.js, starting with 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 version | NPM version | Yarn 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 the **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.

{% code title="package.json" %}

```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
    }
}
```

{% endcode %}

General documentation for the **engines** field is available [here](https://docs.npmjs.com/cli/v10/configuring-npm/package-json#engines).

## .node-version

{% hint style="warning" %}
We don't recommend using this method of selecting the Node.js version unless you know what you are doing.
{% endhint %}

{% code title="example .node-version" %}

```
v22.3.0
```

{% endcode %}

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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.readymage.com/project-development/node.js-version.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
