Skip to content

prepare: install Corepack when the active Node does not ship it - #28

Merged
william-gr merged 1 commit into
masterfrom
prepare-install-corepack
Nov 8, 2026
Merged

william-gr merged 1 commit into
masterfrom
prepare-install-corepack

Conversation

@william-gr

Copy link
Copy Markdown
Contributor

Why

Node 25 and later no longer ship Corepack. With node-version: 26.7.0, the Enable Corepack for Yarn 4 step fails in a container job: cui run 42428723000, e2e-connect, in the mcr.microsoft.com/playwright:v1.65.0-noble image, gives corepack: command not found (exit 127).

The same Node version passes on plain ubuntu-latest jobs in that run only by accident: the runner image's own Node 24 leaves /usr/local/bin/corepack on PATH, and corepack enable goes through it. Any consumer that moves to Node 25+ depends on that leftover.

Checked against the release tarballs: node-v26.7.0-linux-x64 has no corepack; node-v24.16.0-linux-x64 has bin/corepack.

Change

A step between setup-node and corepack enable: if the active Node's bin directory has no corepack, it runs npm install --global corepack@0.36.0 (the current release), which installs next to that Node. It looks in the bin directory rather than PATH, so the runner image's stray Corepack does not satisfy it. Consumers on Node 24 and earlier, including the 24.13.1 default, are unchanged: their bundled Corepack is found and nothing is installed.

The README's prepare section says why.

Testing

  • Locally with Node 26.7.0 first on PATH and an nvm Node 24 corepack still on PATH behind it (the runner's situation): the step installed corepack 0.36.0 into Node 26's bin, corepack enable put yarn there, and yarn --version in cui gave 4.18.1 from its packageManager.
  • Not yet run in CI. cui#58 uses this action at @master; once this merges, re-running its e2e-connect job is the check.

Node 25 and later no longer bundle Corepack, so `corepack enable` fails
with 'command not found' when the action sets up Node 26. On GitHub's
runner images a Corepack from the image's own Node stays on PATH and hides
this; a container job (the Playwright image) has none and fails.

The new step checks the active Node's bin directory, not PATH, and installs
a pinned corepack there with npm when it is missing. Node 24 and earlier
keep their bundled Corepack.
@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown

No findings. No human review needed.

The new step in .github/actions/prepare/action.yml only does something when the active Node's own bin directory has no corepack. With the default node-version (24.13.1) and any Node up to 24, the test passes and the step does nothing, so current callers see no change. When it does run, setup-node has pointed npm's global prefix at that same toolcache Node, so npm install --global puts corepack in the directory the check looked at. The next step's corepack enable then writes its shims there. The version comes from env:, not from inline interpolation, and the step fails if npm fails, since that command is the last one in the block. The README paragraph matches what the step does.

I couldn't confirm from this sandbox that corepack@0.36.0 is on the registry. If that version doesn't exist, the first Node 25 caller will fail loudly at this step, not silently.

The failing check-ticket check is about the PR title or description not naming a ticket. It's unrelated to the code in this change.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. No findings.

Nothing blocks and no human review is needed.

@william-gr
william-gr merged commit c7de208 into master Nov 8, 2026
7 of 8 checks passed
@william-gr
william-gr deleted the prepare-install-corepack branch November 8, 2026 00:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant