Specifying a Node Version
By default, Render uses Node version 14.17.0
. 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.
-
Add an environment variable called
NODE_VERSION
to your app and set the value to a valid version, for example14.17.5
. -
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. -
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. -
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 firstpackage.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 aNODE_VERSION
environment variable or added a.node-version
or.nvmrc
file containing a valid version to the root of your repo.