Specifying node version isn't working

I’ve tried specifying the node version using the following suggestions:

But it’s not working. I’ve tried setting NODE_VERSION environment variable to 18 in the Netlify dashboard, and in netlify.toml I’ve tried:


I’ve also tried creating an .nvmrc file with the text 18 as the only entry.

However, if I run console.log(process.version) in one of my functions, it always returns v16.16.0

Hi @paulrudy, the link below contains information of the default version of node that is currently active (file updated 12 days ago from today’s date) in the Official Netlify GitHub repository for the build image. As you can see in the Node.js section, the latest version of Node.js currently supported is version 16.

Hope this helps.


1 Like

Hi @clarnx thanks for the link. But I’m not seeing anything in it that suggests that Node version 16 is the latest version currently supported, only that it’s the default version:

  • Node.js - NODE_VERSION, .nvmrc, .node-version
    • 16 (default)
    • Any version that nvm can install.

“Any version that nvm can install” seems to imply that version 18 should work.

Hi @paulrudy.

The quote above is true however it means that when you set your Node version to 18, during the build it will attempt to use Node version 18 but once the build is complete it still defaults to Node version v16.16.0

The build log below is a test I made by creating a function that returns the Node version as a JSON. Even though the version set during build is version 18, the process.version still returns v16.16.0. Hence v16 is the default as stated in the link I shared

4:47:08 PM: Attempting node version ‘18’ from .nvmrc

4:47:08 PM: Downloading and installing node v18.12.1…

4:47:08 PM: Downloading https://nodejs.org/dist/v18.12.1/node-v18.12.1-linux-x64.tar.xz

4:47:09 PM: Computing checksum with sha256sum

4:47:09 PM: Checksums matched!

4:47:12 PM: Now using node v18.12.1 (npm v8.19.2)

Hope this clarifies any confusion.


Thanks, but I’m still confused.

In your example, is the build running v18 even though process.version is returning v16? Why would that be?

Or if the build is actually running v16, why? The docs seem to indicate that the version can be something other than the default.

Hi @paulrudy.

Yes my build was set using Node v18. However after its been built and deployed, when you console.log or respond back as JSON using process.version, you still get v16.16.0.

Above is the another build log where I even changed the Node.js version to v19 and the output of process.version is still 16.16.0.

You can try a demo yourself and monitor the build logs. It downloads and uses the version you set in NODE_VERSION or the .nvmrc. However the output of process.version defaults back to 16.16.0.

The quoted text above from the Official Netlify GitHub repository is quite confusing but below is how I understand it as far as I know.

Your site or app will be built using the version of Node.js you set using either NODE_VERSION or the .nvmrc, However when Netlify is deploying your bundled application, the Node.js environment is set to the default version of Node.js which is 16.16.0.

Think of it this way. Lets say I packaged an application using Node.js version 18 and then sent it to you to run in your environment using Node.js 16.

The application or site will still run in your Node.js 16 environment.
When you output the value of process.version at your end even though the application was packaged using Node.js version 18, it will not show my version of Node.js but your Node.js version since it’s now running in your Node.js environment.

Keep in mind Building and Deploying can be in different environments.

Hope the analogy above helps.

1 Like

Thanks, I appreciate the explanation. It’s a bit confusing but much clearer now!

1 Like

Non sense.

Declare node version in package.json and netlify.toml as

"engines": {
    "node": ">=18.12.1"
    "node": ">=18.12.1"

all my sitse are using node version 18.12.1

Hi @donaldboulton, thanks for commenting.

However have you tried to console.log(process.version) in your application to see if it’s showing your current version of Node.js or not and also show evidence of it working as expected before replying with inappropriate or harsh remarks?

This forum is a friendly community therefore we should be polite and empathetic towards one another.

Also if you disagree with someone you can politely correct someone or point the person in the right direction instead of using inappropriate or harsh remarks.

Kindly read the Code Of Conduct at the link below in order not to repeat similar mistakes next time.

All in all we are all here to learn therefore kindly share the output of console.log(process.version) in your application to see if it displays your version of Node.js or not.


1 Like

@clarnx, my experiments continue to seem to confirm your response. I wasn’t able to confirm any of @donaldboulton’s claims. And I’m sorry for the abuse that user has been serving up.

It does appear as you pointed out that build logs have no bearing on what node version is used and the line Now using node vXX.XX in the build log does not have any bearing on whether that node version is used at runtime, based on checking console.log(process.version).

In fact, although it was possible for me to specify node v 14.x by simply setting the env variable AWS_LAMBDA_JS_RUNTIME to 14.x, the build would fail when AWS_LAMBDA_JS_RUNTIME was set to >=18.12.1 or to 18.x with the message:

You've specified an unsupported runtime identifier. Please visit https://ntl.fyi/supported-runtimes to learn more.

That page shows clearly that as of now, nodejs16.x is the latest supported runtime, which explains the error.

Also, adding the following code in package.json appeared to have no effect:

engines": {
    "node": ">=18.12.1"

Nor did including AWS_LAMBDA_JS_RUNTIME in package.json

(It’s worth pointing out that these things need to be tested with actual deploys on netlify, not test deploys using netlify dev)

1 Like

I’ve deleted the second post by @donaldboulton above. I’ve also addressed their breaking the code of conduct with them in a private message.

I also want to thank you both, @clarnx and @paulrudy, for staying calm and remaining polite in your own replies. Thank you as well for posting a link to the code of conduct above, @clarnx.

@paulrudy, you seem to have a found the answers to your questions. However, if I’m mistaken and there are unanswered questions, please feel free to reply here anytime.