In your build instructions for Node apps (Manage build dependencies | Netlify Docs), the recommended way to set a Node version is via a .node-version file or NODE_VERSION env var; and similarly use NPM_VERSION to set the npm version, and YARN_VERSION to set the yarn version.
The approach you’re using can lead to a situation where the Node, npm and/or yarn versions used on the developer’s machine are not the same as in a Netlify build, leading to build failures or strange variation.
Don’t Repeat Yourself – this info should be in only one place. It would be better to use the package.json mechanism. If that can’t be done, it would make sense to add a prominent warning to your doc page that I referenced about to say the standard Node approach is IGNORED.
Is this not a thing yet??
It would really nice since this is the standard way to set Node versions.
I am suprised it’s not already integrated considering JAMstack and all.
Hi, @QuantumJS. The feature request is linked to above. I checked the feature request but it is still “open” (meaning the feature request has not be completed yet).
If or when this feature request is added, we will post an update here.
So, what is the status of this?
The default node netlify uses it’s quite old. Kind of bad experience that your build fails because the CI uses an outdated node version.
What site is it? Chances are you started building on Node 10 at first and we don’t upgrade the Node Versions automatically to prevent errors due to breaking changes. All new sites use Node 16 by default, which will likely be pinned too, so they don’t break in future.
Just to confirm, @swrobel, if your concern about not being able to specify Node version, or is it about not being able to specify it in package.json? The former is already supported.