Skip to content

Framework: Update Node.js to v24 (wp/5.5) - #86873

Draft
sirreal wants to merge 15 commits into
wp/5.5from
build/node-24-wp-5.5
Draft

sirreal wants to merge 15 commits into
wp/5.5from
build/node-24-wp-5.5

Conversation

@sirreal

@sirreal sirreal commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

What?

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

Why?

The wordpress-develop 5.5 branch moves to Node.js 24 in WordPress/wordpress-develop#15700. 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. 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, bin/plugin/lib/git.js loads simple-git instead of simple-git/promise and gets // @ts-nocheck, and packages/env/CHANGELOG.md gets the backported breaking change entry.
  • packages/react-native-editor/package.json installs react-native-svg from GitHub's tarball of the same commit (https://codeload.github.com/wordpress-mobile/react-native-svg/tar.gz/a628e92990a2404e30a0086f168bd2b5b7b4ce96) instead of from git, as [RNMobile] Use tarball instead of git tag for react-native-editor forked dependencies #34886 did on trunk for the native editor's forked dependencies. npm 11 runs a git dependency's prepare script, and react-native-svg's Babel build fails under npm 11; a tarball needs no prepare. Only the native editor uses the package.
  • 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.5 uses, and a root overrides entry, "node-sass": "$node-sass", gives the same alias to @wordpress/scripts, which asks for node-sass ^4.13.1. 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.
  • .npmrc sets legacy-peer-deps = true, which keeps npm 6's peer dependency handling. Without it npm ci fails with ERESOLVE, because eslint-plugin-import 2.20.2 asks for a peer eslint from 2 to 6.
  • build and dev run wp-scripts with cross-env NODE_OPTIONS=--openssl-legacy-provider, and bin/test-create-block.sh exports the same NODE_OPTIONS: webpack 4 and @wordpress/dependency-extraction-webpack-plugin hash with md4, which OpenSSL 3 disables.
  • test-unit sets NODE_OPTIONS="--openssl-legacy-provider --unhandled-rejections=warn". packages/data/src/test/registry.js leaves a promise rejected, which ends the Jest worker on Node.js 15 and later. Node.js 14 only warned.
  • bin/validate-package-lock.js reads the lockfile's packages section instead of dependencies, which lockfile version 3 does not have, as minimal node and npm upgrade #53426 did on trunk.
  • .github/workflows/end2end-test.yml runs npx wp-scripts test-e2e instead of $( npm bin )/wp-scripts test-e2e, as minimal node and npm upgrade #53426 did on trunk: npm 9 removed npm bin, so every end-to-end job exited before running a test.
  • 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 are removed. react-native-svg stays at 9.13.6-gb, resolved from the tarball. 91 entries that no package requires are dropped.

Testing Instructions

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

The built JavaScript is byte-identical to a Node.js 14 build of wp/5.5, and the unit test and npm run test:create-block results are the same. Dart Sass changes 48 CSS files: it adds @charset "UTF-8" and writes icon code points in content as characters, writes 10 decimals instead of 5, does not merge two adjacent identical @media blocks in edit-post, and lays out whitespace and comments in the unminified package styles differently. The minified rules are otherwise the same.

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 13 commits November 12, 2026 10:21
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)
… does not need to prepare.

npm 11 runs the git dependency's prepare script, which fails to build it with the newer Babel parser npm 11 installs for it. The tarball of the same commit needs no prepare. Only the native editor uses the package, through its src entry point.
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.5 builds its own styles with, for the root and for @wordpress/scripts. 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 and @wordpress/dependency-extraction-webpack-plugin hash with md4, which OpenSSL 3 disables. wp-scripts starts webpack and Jest's runner as separate processes, so build, dev and test-unit set NODE_OPTIONS through cross-env, and bin/test-create-block.sh exports it.
npm 11 rejects the version 1 lockfile: its entries for GitHub-hosted dependencies do not satisfy package.json, and it lacks the simple-git 2 that wp-env now uses and the sass that node-sass now aliases. simple-git is held at 2.35.0, the version the simple-git change locked on trunk. No other dependency changes version apart from simple-git's own dependencies. legacy-peer-deps keeps npm 6's peer dependency handling, which the tree relies on.
A version 3 lockfile has no dependencies section. Same change as #53426 made on trunk.
packages/data/src/test/registry.js leaves a promise rejected. Node.js 15 and later end the process on an unhandled rejection, which ends the Jest worker and fails the suite; --unhandled-rejections=warn restores Node.js 14's behavior.
…h npm 11 does not need to prepare."

This reverts commit adff369.
…ommit

npm 11 runs a git dependency's prepare script, and react-native-svg's fails to build it with the newer Babel parser npm 11 installs for it. A tarball needs no prepare; trunk moved the native editor's forked dependencies to tarballs in #34886. The fork has no committed tarball for this commit, so this uses GitHub's archive of it.
…spec

npm install --package-lock-only --lockfile-version 3 with npm 11. Only the react-native-svg range recorded for packages/react-native-editor changes; the installed react-native-svg entry, its resolved URL and integrity are unchanged.
@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
npm 9 removed `npm bin`, so `$( npm bin )/wp-scripts` runs as `Unknown: command not found` under npm 11 and every end-to-end job exits with code 127. The wp/5.4 end-to-end workflow already calls ./node_modules/.bin/wp-scripts.
Same form as #53426 used on trunk to replace `$( npm bin )`, which npm 9 removed.

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