Skip to content

Framework: Update Node.js to v24 (wp/5.4) - #86872

Draft
sirreal wants to merge 8 commits into
wp/5.4from
build/node-24-wp-5.4
Draft

sirreal wants to merge 8 commits into
wp/5.4from
build/node-24-wp-5.4

Conversation

@sirreal

@sirreal sirreal commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

What?

Sets .nvmrc to Node.js 24.20 on wp/5.4, as on trunk, and makes the branch install, build and run its unit tests with Node.js 24 and npm 11.

Why?

The wordpress-develop 5.4 branch moves to Node.js 24 in WordPress/wordpress-develop#15697. This branch's CI takes Node.js from .nvmrc, and with only that change npm ci fails on Node.js 24 and npm 11.

How?

  • .nvmrc is 24.20.
  • Backports wp-env: Use Simple Git instead of NodeGit #28848 and its follow-up Fix wp-env can't checkout git repositories of a specific tag. #31271: wp-env clones, fetches (with --tags) and checks out git sources with simple-git instead of NodeGit, which does not build on Node.js 24 and fails npm ci. On this branch the code is in packages/env/lib/download-source.js and uses source.path. packages/env depends on simple-git ^2.35.0 in place of nodegit, the root simple-git devDependency moves from 1.113.0 to ^2.35.0, and packages/env/CHANGELOG.md gets the backported breaking change entry. bin/commander.js keeps require( 'simple-git/promise' ), which simple-git 2.35.0 still provides. The backported change to bin/plugin/lib/git.js is left out, because that file does not exist on this branch.
  • Package styles build with Dart Sass: the node-sass devDependency (LibSass 4.14.1, which has no Node.js 24 binary and does not compile against it) becomes npm:sass@1.32.8, the sass version WordPress 5.4 uses. bin/packages/build-worker.js passes Sass an importer that returns node_modules/react-dates/lib/css/_datepicker.css as SCSS: Dart Sass reads an imported .css file as plain CSS and rejects its darken() call, which LibSass compiled.
  • build and dev run webpack as node --openssl-legacy-provider ./node_modules/webpack/bin/webpack.js in place of wp-scripts build and wp-scripts start, because webpack 4 hashes with md4, which OpenSSL 3 disables. The wp-scripts commands start webpack in a new process, which a flag on the outer node does not reach. build sets NODE_ENV=production, as wp-scripts build did.
  • test-unit runs @wordpress/scripts' test-unit-js.js with node --openssl-legacy-provider --unhandled-rejections=warn, which is what wp-scripts test-unit-js ran. The webpack plugin test suites run webpack inside Jest, and packages/data/src/test/registry.js and packages/env/test/config.js leave a promise rejected, which ends the Jest worker on Node.js 15 and later. Node.js 14 only warned.
  • test-unit-php and test-unit-php-multisite set npm_package_wp_env_plugin_dir=gutenberg with cross-env. wp-scripts env test-php builds the PHPUnit config path from that variable, which npm 6 set from package.json's wp-env field and npm 7 and later no longer set, so PHPUnit looked in wp-content/plugins/undefined/.
  • .npmrc sets legacy-peer-deps = true, which keeps npm 6's peer dependency handling.
  • Converts package-lock.json from lockfile version 1 to 3 with npm 11. Installed versions change only through the changes above: sass 1.32.8 replaces node-sass 4.14.1, whose dependencies are removed; simple-git moves from 1.113.0 to 2.35.0, the version wp-env: Use Simple Git instead of NodeGit #28848 locked, and its nested debug and ms from 4.1.1 and 2.1.1 to 4.4.3 and 2.1.3; @kwsites/file-exists 1.1.1 (with a nested debug 4.4.3 and ms 2.1.3) and @kwsites/promise-deferred 1.1.1 are added; nodegit 0.27.0 and the packages only it used, such as got 10 and node-pre-gyp, are removed. 18 nested entries that no package requires, under @lerna/*, @jest/reporters, file-system-cache, fstream and metro-cache, are dropped.

Testing Instructions

With Node.js 24 and npm 11: npm ci && npm run build && npm run test-unit.

The built JavaScript and every other non-CSS file is byte-identical to a Node.js 14 build of wp/5.4, and the unit test results are the same. The built CSS has the same rules; Dart Sass writes them in a different notation: 10 decimals instead of 5, @charset "UTF-8" with literal characters instead of escapes in content, unquoted attribute selector values, hex instead of rgb(), and one @media block per rule instead of merged blocks.

Use of AI Tools

AI assistance: Yes
Tools: Claude Code
Model: Claude Opus 5.5
Used for: Backporting the two PRs, applying the changes, regenerating the lockfile, building and testing on Node.js 14 and 24 and comparing the output, and drafting this description.

sirreal and others added 7 commits November 12, 2026 16:20
Matches trunk's .nvmrc. Node.js 24.20 bundles npm 11.19.
Includes an upgrade to `simple-git` v2.35.0, which allows us to retain our progress meter.

Co-authored-by: Noah Allen <noahtallen@gmail.com>
(cherry picked from commit d7f3337)
LibSass (node-sass 4.14.1) has no Node.js 24 binary and does not compile against Node.js 24. node-sass becomes an alias of sass 1.32.8, the version WordPress 5.4 builds its own styles with. bin/packages/build-worker.js keeps calling render().

Dart Sass reads an imported .css file as plain CSS, so the react-dates stylesheet, which calls darken(), fails to compile. An importer passes that file to Sass as SCSS, as LibSass read it.
webpack 4 hashes with md4, which OpenSSL 3 disables, so webpack and the Jest tests that run webpack get --openssl-legacy-provider. `wp-scripts build` and `wp-scripts start` start webpack in a new process, which does not receive the flag, so the scripts run webpack's binary with node directly.

Jest also gets --unhandled-rejections=warn, Node.js 14's behavior: packages/data/src/test/registry.js and packages/env/test/config.js leave promises rejected, which otherwise ends their Jest workers on Node.js 15 and later.
Converts the npm 6 lockfile to lockfileVersion 3 and records the backported simple-git change. `legacy-peer-deps = true` makes npm 11 resolve peer dependencies as npm 6 did.

simple-git is 2.35.0, with @kwsites/file-exists and @kwsites/promise-deferred 1.1.1, the versions gutenberg#28848 installed. nodegit 0.27.0 and its dependencies are removed, and sass 1.32.8 replaces node-sass 4.14.1 and its dependencies. 18 nested entries that nothing requires are dropped. No other installed version changes.
@sirreal sirreal added the [Type] Build Tooling Issues or PRs related to build tooling label Nov 16, 2026
@coderabbitai

coderabbitai Bot commented Nov 16, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@github-actions github-actions Bot added the [Tool] Env /packages/env label Nov 16, 2026
`wp-scripts env test-php` builds the PHPUnit config path from npm_package_wp_env_plugin_dir, which npm 6 set from package.json's "wp-env" field. npm 7 and later no longer export arbitrary package.json fields, so on npm 11 the path is wp-content/plugins/undefined/. test-unit-php and test-unit-php-multisite set it to gutenberg, the "wp-env" "plugin-dir" value. test-php.js reads no other npm_package_wp_env_* variable.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Tool] Env /packages/env [Type] Build Tooling Issues or PRs related to build tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants