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.
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.
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…
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.
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
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.
@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)
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.