Specifying a Node Version


By default, Render uses the latest LTS version of Node. You can customize this for your app in one of the four ways listed below, in order of precedence. The version can be specified using a semantic version number like 14.17.5 or using an alias like lts.

Render uses the node-version-alias module to resolve version aliases and semver ranges.

  1. Add an environment variable called NODE_VERSION to your app and set the value to a valid version, for example 14.17.5.

  2. Add a file called .node-version at the root of your repo containing a single line specifying the version.

    Your .node-version should look like this:

    14.17.5

    This is only used if you haven’t set the NODE_VERSION environment variable.

  3. Add a file called .nvmrc at the root of your repo. Similar to .node-version, this file should contain a single line specifying the version.

    This is only used if you haven’t set the NODE_VERSION environment variable and don’t have a valid version in a .node-version file at the root of your repo.

  4. Alternatively, you can specify a Node version in the engines directive in your package.json.

    This is the relevant snippet from a sample package.json:

      "engines": {
        "node": ">=14 <15"
      }

    If a package.json is not found in the root of your repo, the first package.json found in a subdirectory will be used.

    The version in the package.json engines.node property is only used if you haven’t set a NODE_VERSION environment variable or added a .node-version or .nvmrc file containing a valid version to the root of your repo.