Setting Your Node.js Version
Current default Node.js version |
---|
Services created before 2024-10-30 have a different default version. See below. |
Set a different Node.js version in any of the following ways (in descending order of precedence):
-
Set the
NODE_VERSION
environment variable for your service in the Render Dashboard: -
Add a file named
.node-version
to the root of your repo. This file contains a single line with the version to use:18.18.0
-
Add a file named
.nvmrc
to the root of your repo. This file uses the same format as.node-version
. -
Specify a Node.js version range in your
package.json
file, under theengines
property:"engines": { "node": ">=18.18.0 <19.0.0" }
If there isn’t a
package.json
file in your repo’s root directory, Render uses the firstpackage.json
file it finds in a subdirectory.Always include an upper bound in your version range.
An unbounded range (such as
>=18
) always resolves to thelatest
release of Node.js, which increments its major version over time. This might result in unexpected behavior or incompatibilities with your development version.
You can specify either a semantic version number (such as 18.18.0
) or an alias (such as lts
).
Render uses the node-version-alias
module to resolve version aliases and semver ranges.
History of default Node.js versions
If you don’t set a Node.js version for your service, Render’s default version depends on when you originally created the service:
Service Creation Date | Default Node.js Version |
---|---|
2024-10-30 and later | 22.10.0 |
2024-07-09 to 2024-10-30 | 20.15.1 |
2024-04-17 to 2024-07-09 | 20.12.2 |
2024-04-04 to 2024-04-17 | 20.12.1 |
2024-03-27 to 2024-04-04 | 20.12.0 |
2024-02-23 to 2024-03-27 | 20.11.1 |
2023-11-29 to 2024-02-23 | 20.10.0 |
Before 2023-11-01 | 14.17.0 |