On this page

I wanted to update the node version on one of my Astro projects hosted on Netlify and discovered there are 3 ways to do it:

Using the UI

You can go to Site configuration > Build & deploy > Continuous deployment > Dependency management and select the Node version you want from a dropdown.

This is the Netlify UI as of August 2024

Using an environment variable

Set an environment variable called NODE_VERSION and set it to a valid Node version or anything compatible with nvm, like "5.9", "lts" or "node" (this grabs the latest version)

This is the Netlify UI as of August 2024

Using a special file

You can add a .node-version or .nvmrc file to your project's base directory, and, like with an env variable, you can use any valid Node version or anything that nvm understands.

What about the Node version for functions?

The Node version for Netlify functions can only be changed by adding the AWS_LAMBDA_JS_RUNTIME environment variable and setting it to one of the supported runtimes you see here.

For example, if you want to use Node v20, you should set the env variable to nodejs20.x.