Skip to content

Framework: Update Node.js to v24 (wp/5.8) - #86876

Draft
sirreal wants to merge 14 commits into
wp/5.8from
build/node-24-wp-5.8
Draft

sirreal wants to merge 14 commits into
wp/5.8from
build/node-24-wp-5.8

Conversation

@sirreal

@sirreal sirreal commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

What?

Sets .nvmrc to Node.js 24.20 on wp/5.8, 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.8 branch moves to Node.js 24 in WordPress/wordpress-develop#15706. 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.
  • engines.npm drops its <7 bound, which rejects npm 11. engine-strict = true stays in .npmrc; no dependency's engines rejects Node.js 24.
  • 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.
  • .npmrc sets legacy-peer-deps = true, which keeps npm 6's peer dependency handling. Without it npm ci fails with ERESOLVE, because react-native 0.61.5 asks for a peer react 16.9.0.
  • 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. @wordpress/babel-preset-default's build script runs node --openssl-legacy-provider ./bin/index.js, because core-js-builder runs webpack inside that process; this also covers the npx lerna run build step of the unit test job.
  • 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. The only installed version changes are inside appium, which runs the native end-to-end tests: npm 11 installs the versions in appium's own npm-shrinkwrap.json, which npm 6 did not apply here. fs-extra moves from 9.1.0 to 9.0.1 and universalify from 2.0.0 to 1.0.0 under appium, string-width from 4.2.2 to 4.2.0 under appium-fake-driver, and y18n from 4.0.3 to 4.0.1 under appium-fake-driver and appium-tizen-driver. react-native-svg stays at 9.13.6-gb, resolved from the tarball. 51 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 build output is byte-identical to a Node.js 14 build of wp/5.8, and the unit test results are the same.

Known failure, left for a later change: the Create Block check (npm run test:create-block) fails on Node.js 24. css-loader 5.1.3 loads its nested postcss 8.2.8, whose exports field Node.js 17 and later reject with ERR_PACKAGE_PATH_NOT_EXPORTED.

Use of AI Tools

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

npm 11 rejects the version 1 lockfile: its entries for GitHub-hosted dependencies do not satisfy package.json. Version 2 keeps the dependencies section that bin/validate-package-lock.js reads. legacy-peer-deps keeps npm 6's peer dependency handling, which the tree relies on.
…pm 11 installs them.

npm install --package-lock-only cannot read the contents of a bundled dependency's tarball; a full npm install records them, and without this commit npm install rewrites these entries, which fails the Static Analysis local changes check.
…lder

webpack 4, core-js-builder (run by the babel-preset-default build) and @wordpress/dependency-extraction-webpack-plugin hash with md4, which OpenSSL 3 disables. core-js-builder runs in the node process its build script starts, so the flag goes on that command. 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.
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.
A version 3 lockfile has no dependencies section. Same change as #53426 made on trunk.
…h npm 11 does not need to prepare."

This reverts commit f882928.
…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] Babel preset /packages/babel-preset-default 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] Babel preset /packages/babel-preset-default [Type] Build Tooling Issues or PRs related to build tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant