Node Version not Found (Failed to install node version '16.13.2')

Hello,
Just want to start by saying Netlify is awesome, so much so that I recently upgraded to Pro. Keep up the great work :slight_smile:

But am currently having an issue regarding setting the Node version. I’ve recently upgraded my project to Node LTS / 16.13.2.

For some reason, Netlify is still using v12.18.0 by default, and it doesn’t seem to read the engines.node value from a project’s package.json. So following the docs, I set NODE_VERSION to 16.13.2, and also did the same in the .nvmrc file.

But with both methods, I get an error saying NVM cannot find that version of Node.

10:50:16 PM: Started restoring cached node version
10:50:19 PM: Finished restoring cached node version
10:50:19 PM: Attempting node version '16.13.2' from .nvmrc
10:50:20 PM: Version '16.13.2' not found - try `nvm ls-remote` to browse available versions.
10:50:20 PM: Failed to install node version '16.13.2'

I’m confused, it seems to be reading the file just fine, but why can’t it find 16.13.2? It’s a valid version, it’s the official LTS version, and I’m using it on my own system through NVM.

Am I doing something wrong?

For reference,
My Netlify project is: dashy-dev
It’s deployed to: dev.dashy.to
The source code it: github.com/Lissy93/dashy
And the PR which is breaking is: #471

Thank you very much,
Alicia

Hey @Lissy93,

Based on what I remember when checking your site in the helpdesk, this issue was resolved. Are you still seeing this?

Found the issue!

My editor had appended a trailing line in the .nvmrc file.
The solution was to strip out any invisible line breaks.

Was stuck on this for hours, and such a simple solution :woman_facepalming:


As a future improvement, it would be useful if Netlify could either strip out any trailing spaces from the .nvmrc file, or at least throw a more meaningful error.

Netlify is using an unsupported, and very old version of Node.js version by default. It would be awesome if this could be updated to at least Node LTS. Even better, if it could use the version specified in an app’s package.json (under the engines field) could be used, or if we could set the version in netlify.toml instead of having a separate file clogging up the root directory.
The current method of handling Node versions is really quite inconvenient.

1 Like

Yes, thank you very much @hrishikesh. It turned out that end of line sequences aren’t stripped from the version file when it’s read, doing this manually fixed the issue for me - thank you for your help :slight_smile:

1 Like

Netlify uses Node 16 by default :slight_smile:

You can use:

[build.environment]
  NODE_VERSION = "16"
1 Like