I keep coming across situations where I need to Netlify about the to use while building my sites (eg. when building ). Multiple times now, I’ve not been able to find the correct documentation related to this quickly. Guessing that I’m not the only one facing this issue, I decided to write a quick article to offer a solution. tell Node version countmywords.in Default Node Version Netlify creates a to set up your site behind the scenes. The used to create this container defines the software versions installed (including Node). Docker container build image If you don’t specify a Node version explicitly, Netlify uses the that comes pre-installed in its Docker container. Once you build a site using the default Node version, Netlify locks or your site to that Node version so that your site’s builds continue using the same Node version even when the default Node version in Netlify’s Docker build image changes with time. Your deployment workflow will thus not break when Netlify updates its build image to use a newer version of Node as the default. default Node version pins For example, imagine that it’s late 2021 and you are using Node to build your Eleventy site on Netlify. Node is the latest version and it makes sense for Netlify to include it as the default Node version in its containers. Now, fast forward to March 2023. Netlify has updated the software versions included in its containers and Node is now its default Node version. For some reason you were not able to update your code during this time and your site still requires Node . 16 16 18 16 However, when you trigger a build on Netlify, your build still goes through without any errors. Because Netlify had pinned your site to use Node (to match the Node version used in the previous build), it used Node in the current build rather than Node (which would only be used in new projects). 16 16 18 Explicitly Specify a Node Version There are two main methods for specifying a Node version in Netlify builds: Set an environment variable called . NODE_VERSION Create a or file that is stored in the base directory of your code repository. .node-version .nvmrc You can specify the version information as the version number (full or partial) for any Node release or a string that accepts. Some examples are , , , and . You can read more about the supported inputs on nvm’s . nvm 16 16.2 18.5.0 node lts/fermium documentation Method 1: Set a NODE_VERSION Environment Variable Netlify allows you to set to configure your site’s build and functionality. Among other things, you can use them to specify the versions of some software available during the build. environment variables Netlify supports two kinds of environment variables- and . Site environment variables are set at the site level whereas shared environment variables are set at the team level and all the sites owned by a team has access to them. site shared In this article, to set the Node version for a particular site’s build. you will use a site environment variable Further, Netlify offers multiple methods to set environment variables. To reduce decision fatigue, you will use their UI to set site environment variables. To do so, select a site from the Netlify dashboard and go to . Site Settings -> Environment variables Method 2: Create a Configuration File Supported by a Node Version Manager Node version managers allow you to install multiple Node versions on a machine and switch to a particular one based on your project’s needs. Netlify’s build containers come installed with a Node version manager that can be configured using a file. You can specify a Node version by creating a or file with the version information and adding it to your base directory. .node-version .nvmrc An aside on these files. The file is fairly well-known these days as nvm has become the most popular version manager for Node. The file is a similar configuration file that is supported by a few . .nvmrc .node-version other version managers . Originally published on architchandra.com The featured image for this piece was generated with stable diffusion v2.1. Prompt: Software nodes.