Update README with Node.js version requirement
Added a note about the required Node.js version.
Description
Just a Quick Heads Up in the README file for what node version the project requires exactly
Motivation
Even though it’s just a small edit, this prevents setup errors like the one I encountered (EBADENGINE) when using Node.js < 24. This heads-up ensures contributors know the minimum Node.js version required to build the site.
Additional details
Related issues and pull requests
Fixes #42415
Hey! Thank you for the suggestion. Node.js v24 only recently became LTS and many people might still use previous versions.
But I'm afraid the README is too far away to notice. I wonder if showing a good error right in the console with a script like this would be better:
{
"type": "module",
"engines": {
"node": ">=24"
},
"scripts": {
"preinstall": "node -e \"import pkg from './package.json' assert { type: 'json' }; const v=pkg.engines.node.slice(2); if (process.versions.node.split('.')[0] < v) { console.error(`✖ Node.js v${v} is required.`); process.exit(1) }\""
}
}
@caugner, what do you think?
Added a note about the required Node.js version.
Instead of mentioning the Node.js version in the README, let's either recommend using nvm, or point them to .nvmrc which contains the version number.
I wonder if showing a good error right in the console with a script like this would be better:
We have enabled engine-strict now, so running npm install with an older version yields the following error message:
% npm ci
npm error code EBADENGINE
npm error engine Unsupported engine
npm error engine Not compatible with your version of node/npm: @mdn/[email protected]
npm error notsup Not compatible with your version of node/npm: @mdn/[email protected]
npm error notsup Required: {"node":">=24"}
npm error notsup Actual: {"npm":"10.9.4","node":"v22.21.1"}
running npm install with an older version yields the following error message:
% npm ci npm error code EBADENGINE npm error engine Unsupported engine npm error engine Not compatible with your version of node/npm: @mdn/[email protected] npm error notsup Not compatible with your version of node/npm: @mdn/[email protected] npm error notsup Required: {"node":">=24"} npm error notsup Actual: {"npm":"10.9.4","node":"v22.21.1"}
I wouldn't say it's the most friendly message. It's something, but might not be clear what to do. The "EBADENGINE" name alone is something else 🙄
npm error notsup Required: {"node":">=24"} npm error notsup Actual: {"npm":"10.9.4","node":"v22.21.1"}
These last two lines have all the information the user needs to act.
I don't see any evidence that this is an issue. Besides, https://nodejs.org/en/download defaults to Node v24.