#66099 closed enhancement (fixed)
Build/Test Tools: Install the npm version required by `package.json` in GitHub Actions
| Reported by: | manzoorwani.jk | Owned by: | lancewillett |
|---|---|---|---|
| Priority: | normal | Milestone: | 7.2 |
| Component: | Build/Test Tools | Version: | trunk |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: |
Description
GitHub Actions uses the npm bundled with Node.js. It satisfies engines.npm only because Node.js 24.18.1 happens to bundle exactly npm 11.16.0, so raising the npm floor above the bundled version would fail every job.
Gutenberg already installs the npm version declared in devEngines.packageManager (https://github.com/WordPress/gutenberg/pull/82235), as we prepare to move to npm 12 (https://github.com/WordPress/gutenberg/pull/82732), a security release that makes dependency install scripts and git dependencies opt-in. The Node.js Release WG will not bundle npm 12 with Node.js 22, 24 or 26 (https://github.com/nodejs/Release/issues/1161#issuecomment-5280655481), so CI has to install it.
Proposal, mirroring https://github.com/WordPress/gutenberg/pull/82775 and https://github.com/WordPress/gutenberg/pull/82823:
- Add the same
devEnginesfield as Gutenberg topackage.json. - Add a
setup-npmaction that installs that npm version and owns the npm download cache. - Disable npm caching in
actions/setup-node, which makes it run the bundled npm and fails thedevEnginescheck, if we use the latest npm version.
This keeps Node.js, npm and CI behaviour consistent across both repositories. Release branches that run these workflows from trunk keep their bundled npm.
Change History (9)
This ticket was mentioned in PR #13505 on WordPress/wordpress-develop by @manzoorwani.jk.
4 weeks ago
#1
- Keywords has-patch added
@manzoorwani.jk commented on PR #13505:
4 weeks ago
#2
I can't request a review, so CCing you all
@desrosj @lancewillett @aduth @ciampo @jsnajdr @tyxla
@manzoorwani.jk commented on PR #13505:
3 weeks ago
#3
I would appreciate it if this could be expedited; it will help prepare the repo for npm v12, which we are tracking in https://github.com/WordPress/gutenberg/issues/82328
This ticket was mentioned in PR #13656 on WordPress/wordpress-develop by @manzoorwani.jk.
3 weeks ago
#6
Adds the devEngines block from the root package.json to Twenty Twenty-One, Twenty Twenty-Two and Twenty Twenty-Five for consistency with Core. With onFail: "error", npm refuses to install when the Node.js or npm version is below what engines already declares. Versions match trunk (Node.js >=24.18.0, npm >=11.16.0), and the lockfiles are unchanged.
Follow-up to #13505.
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5
Used for: Implementation and this description, reviewed by me.
---
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.
🤖 Generated with Claude Code
@manzoorwani.jk commented on PR #13656:
3 weeks ago
#7
CC @lancewillett @adimoldovan @desrosj @johnbillion
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Adds a
setup-npmaction, mirroring https://github.com/WordPress/gutenberg/pull/82775 and https://github.com/WordPress/gutenberg/pull/82823, so CI installs the npm required bydevEngines.packageManagereven when Node.js bundles an older one. It also adds the samedevEnginesfield as Gutenberg topackage.json.actions/setup-noderesolves it with the bundled npm, which fails withEBADDEVENGINESonce a newer npm is required.trunkagainst their own checkout, which lacks the action. A `hashFiles` gate skips it there.pathsfilters now include.github/actions/setup-npm/**.cc @desrosj: unrelated, but 6.9's `test-build-processes.yml` omits
gutenberg-branch, so it builds Gutenbergtrunkon Node.js 20 and every Gutenberg job fails with `EBADENGINE`. Passinggutenberg-branch: 'wp/6.9', as 6.5 to 6.8 do, should fix it.## Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5
Used for: Implementation and this description, reviewed by me.
🤖 Generated with Claude Code