Can't deploy to Netlify due to node version mismatch (tutorial needs >= 12, netlify CI uses 10.x)

See title, netlify deploys fail due to the node engine requirements in the tutorial. relevant CI logs from netlify using the recommended settings:

12:05:00 AM: Installing NPM modules using Yarn version 1.17.0
12:05:01 AM: yarn install v1.17.0
12:05:01 AM: [1/5] Validating package.json...
12:05:01 AM: error @: The engine "node" is incompatible with this module. Expected version ">=12". Got "10.19.0"
12:05:01 AM: error Found incompatible module.
12:05:01 AM: info Visit for documentation about this command.
12:05:01 AM: Error during Yarn install
12:05:01 AM: Error running command: Build script returned non-zero exit code: 1
12:05:01 AM: Failing build: Failed to build site
12:05:01 AM: failed during stage 'building site': Build script returned non-zero exit code: 1
12:05:01 AM: Finished processing build request in 10.414088266s

Hi @chapati23 Can you confirm whether or not you have a .nvmrc file in your root? (If you’ve been working on your repo since last week, we might have added this in without much notice… apologies if that’s the case.)

Regardless, make sure you have that file with this single line:

Netlify will use this to override the node environment for its builds, which in this case will use the most recent LTS node version (something like v12.16 last I checked). You can reference our template directory here if needed:

Thanks, you pointed me in the right direction. I have a global ~/.gitignore where I had .nvmrc listed (because so far I thought it was a best practice to NOT commit this to source control :thinking:)

Removing .nvmrc from my global .gitignore and pushing it did the trick!

1 Like