content icon indicating copy to clipboard operation
content copied to clipboard

Update README with Node.js version requirement

Open Moe-Salim91156 opened this issue 1 month ago • 1 comments

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

Moe-Salim91156 avatar Dec 15 '25 23:12 Moe-Salim91156

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?

pepelsbey avatar Dec 16 '25 09:12 pepelsbey

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"}

caugner avatar Dec 19 '25 11:12 caugner

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 🙄

pepelsbey avatar Dec 19 '25 12:12 pepelsbey

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.

caugner avatar Dec 19 '25 14:12 caugner