Node.js version on Netlify outdated

My website build locally, but on Netlify, its saying it needs a higher Node.js version than what is on Netlify. How do I change the Node.js used on netlify when building my site?

6:12:28 PM: error Gatsby requires Node.js 12.13.0 or higher (you have v10.24.0).

6:12:28 PM: Upgrade Node to the latest stable release: Upgrading Your Node.js Version | Gatsby

6:12:28 PM: npm ERR! code ELIFECYCLE

6:12:28 PM: npm ERR! errno 1

6:12:28 PM: npm ERR! website@1.6.0 build: GATSBY_EXPERIMENTAL_PAGE_BUILD_ON_DATA_CHANGES=true gatsby build --log-pages

6:12:28 PM: npm ERR! Exit status 1

6:12:28 PM: npm ERR!

6:12:28 PM: npm ERR! Failed at the website@1.6.0 build script.

6:12:28 PM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

6:12:28 PM: npm ERR! A complete log of this run can be found in:

6:12:28 PM: npm ERR! /opt/buildhome/.npm/_logs/2021-03-23T16_12_28_239Z-debug.log

Netlify uses Node 12 by default. So, if in your case it’s not using it, it might mean that either you’re having Node as a dependency in your package.json, or you might be overriding it by maybe environment variable or .nvmrc file.

Greetings @darrendube :wave:t2:

And welcome to The Forums! :netliheart:

Netlify’s Node version defaults to the version defined in the build image for your site. By default, Netlify sites are built in the “Xenial” build image, which includes this software automatically installed. As you can see, Xenial’s default is reported as Node v10. (EDIT: this may be out of date after looking at some of the code that actually sets up Xenial… but as a rule of thumb, always set your own tool versions for safety)

You can override the build image’s default Node version in a number of ways — perhaps setting the NODE_VERSION environment variable for your project is the easiest. Just set the value to something like 15.12.0 and the build should automatically install and use v15.12.0.

Hope that helps!