# Specifying node version isn't working

**URL:** <https://answers.netlify.com/t/specifying-node-version-isnt-working/78614>\
**Category:** Support\
**Tags:** lambda-functions\
**Created:** [November 4, 2022, 8:19pm UTC](https://answers.netlify.com/t/specifying-node-version-isnt-working/78614 "2022-11-04T20:19:15Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![paulrudy](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/paulrudy/32/41292_2.png) [@paulrudy](https://answers.netlify.com/u/paulrudy)\
**Post date:** [November 4, 2022, 8:19pm UTC](https://answers.netlify.com/t/specifying-node-version-isnt-working/78614/1 "2022-11-04T20:19:15Z")

</div>

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

> [@\[Support Guide\] Debugging Netlify site builds](https://answers.netlify.com/t/support-guide-debugging-netlify-site-builds/142/1):
>
> You can adjust those versions as follows:
> 
> - Set the Node.js environment with the `NODE_ENV` variable
> - Set a `NODE_VERSION` environment variable from the “Build and Deploy” site settings page in our UI - in the “Build Environment” section. The value inside can be anything you would use with [nvm](https://github.com/creationix/nvm) (eg `8` or `10.11.2`). You can also use a `.nvmrc` file with this number in it.

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:

```auto
[build.environment]
  NODE_VERSION = "18"

```

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`

---

<div class="post-metadata">

**Author:** ![clarnx](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/clarnx/32/40777_2.png) [@clarnx](https://answers.netlify.com/u/clarnx)\
**Post date:** [November 5, 2022, 10:07am UTC](https://answers.netlify.com/t/specifying-node-version-isnt-working/78614/2 "2022-11-05T10:07:56Z")

</div>

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.

> <https://github.com/netlify/build-image/blob/focal/included_software.md#languages>

Hope this helps.

Thanks.

---

<div class="post-metadata">

**Author:** ![paulrudy](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/paulrudy/32/41292_2.png) [@paulrudy](https://answers.netlify.com/u/paulrudy)\
**Post date:** [November 5, 2022, 4:19pm UTC](https://answers.netlify.com/t/specifying-node-version-isnt-working/78614/3 "2022-11-05T16:19:49Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![clarnx](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/clarnx/32/40777_2.png) [@clarnx](https://answers.netlify.com/u/clarnx)\
**Post date:** [November 5, 2022, 4:56pm UTC](https://answers.netlify.com/t/specifying-node-version-isnt-working/78614/4 "2022-11-05T16:56:37Z")

</div>

Hi @paulrudy.

> [@paulrudy](#):
>
> “Any version that `nvm` can install” seems to imply that version 18 should work.

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](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.

---

<div class="post-metadata">

**Author:** ![paulrudy](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/paulrudy/32/41292_2.png) [@paulrudy](https://answers.netlify.com/u/paulrudy)\
**Post date:** [November 5, 2022, 10:44pm UTC](https://answers.netlify.com/t/specifying-node-version-isnt-working/78614/5 "2022-11-05T22:44:50Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![clarnx](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/clarnx/32/40777_2.png) [@clarnx](https://answers.netlify.com/u/clarnx)\
**Post date:** [November 5, 2022, 11:29pm UTC](https://answers.netlify.com/t/specifying-node-version-isnt-working/78614/6 "2022-11-05T23:29:54Z")

</div>

Hi @paulrudy.

> [@paulrudy](#):
>
> In your example, is the build running `v18` even though `process.version` is returning `v16`? Why would that be?

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`.

 ![image](https://global.discourse-cdn.com/netlify/original/3X/e/b/ebb82786e5f2b0c0a7e7c77171b94a5118f53725.png)

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`.

> [@clarnx](#):
>
> ```auto
> * Node.js - `NODE_VERSION`, `.nvmrc`, `.node-version`
> * 16 (default)
> * Any version that `nvm` can install.
> 
> ```

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.  
Thanks.

---

<div class="post-metadata">

**Author:** ![paulrudy](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/paulrudy/32/41292_2.png) [@paulrudy](https://answers.netlify.com/u/paulrudy)\
**Post date:** [November 7, 2022, 10:21pm UTC](https://answers.netlify.com/t/specifying-node-version-isnt-working/78614/7 "2022-11-07T22:21:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![donaldboulton](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/donaldboulton/32/948_2.png) [@donaldboulton](https://answers.netlify.com/u/donaldboulton)\
**Post date:** [November 13, 2022, 9:52pm UTC](https://answers.netlify.com/t/specifying-node-version-isnt-working/78614/8 "2022-11-13T21:52:15Z")

</div>

Non sense.

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

```auto
"engines": {
    "node": ">=18.12.1"
  },
  "AWS_LAMBDA_JS_RUNTIME": {
    "node": ">=18.12.1"
  }

```

all my sitse are using node version 18.12.1

---

<div class="post-metadata">

**Author:** ![clarnx](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/clarnx/32/40777_2.png) [@clarnx](https://answers.netlify.com/u/clarnx)\
**Post date:** [November 14, 2022, 12:10am UTC](https://answers.netlify.com/t/specifying-node-version-isnt-working/78614/9 "2022-11-14T00:10:33Z")

</div>

Hi @donaldboulton, thanks for commenting.

> [@donaldboulton](#):
>
> Non sense.

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.  
[https://answers.netlify.com/faq](https://answers.netlify.com/faq)

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.

Thanks.

---

<div class="post-metadata">

**Author:** ![paulrudy](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/paulrudy/32/41292_2.png) [@paulrudy](https://answers.netlify.com/u/paulrudy)\
**Post date:** [November 14, 2022, 2:54am UTC](https://answers.netlify.com/t/specifying-node-version-isnt-working/78614/11 "2022-11-14T02:54:21Z")

</div>

@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:

```auto
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:

```auto
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`)

---

<div class="post-metadata">

**Author:** ![luke](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/luke/32/39_2.png) [@luke](https://answers.netlify.com/u/luke)\
**Post date:** [November 14, 2022, 5:02am UTC](https://answers.netlify.com/t/specifying-node-version-isnt-working/78614/13 "2022-11-14T05:02:45Z")

</div>

I’ve deleted the second post by @donaldboulton above. I’ve also addressed their breaking the [code of conduct](https://forums-docs.netlify.app/code-of-conduct.html) 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.
