Repository navigation
prepare: install Corepack when the active Node does not ship it - #28
Conversation
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.
|
No findings. No human review needed. The new step in I couldn't confirm from this sandbox that The failing |
Why
Node 25 and later no longer ship Corepack. With
node-version: 26.7.0, theEnable Corepack for Yarn 4step fails in a container job: cui run 42428723000,e2e-connect, in themcr.microsoft.com/playwright:v1.65.0-nobleimage, givescorepack: command not found(exit 127).The same Node version passes on plain
ubuntu-latestjobs in that run only by accident: the runner image's own Node 24 leaves/usr/local/bin/corepackonPATH, andcorepack enablegoes through it. Any consumer that moves to Node 25+ depends on that leftover.Checked against the release tarballs:
node-v26.7.0-linux-x64has nocorepack;node-v24.16.0-linux-x64hasbin/corepack.Change
A step between setup-node and
corepack enable: if the active Node's bin directory has nocorepack, it runsnpm install --global corepack@0.36.0(the current release), which installs next to that Node. It looks in the bin directory rather thanPATH, so the runner image's stray Corepack does not satisfy it. Consumers on Node 24 and earlier, including the24.13.1default, are unchanged: their bundled Corepack is found and nothing is installed.The README's
preparesection says why.Testing
PATHand an nvm Node 24corepackstill onPATHbehind it (the runner's situation): the step installed corepack 0.36.0 into Node 26's bin,corepack enableputyarnthere, andyarn --versionin cui gave 4.18.1 from itspackageManager.@master; once this merges, re-running itse2e-connectjob is the check.