From 35862fbe1f40898da56689147c474a66840772b4 Mon Sep 17 00:00:00 2001 From: William Grzybowski Date: Sat, 7 Nov 2026 21:17:27 -0300 Subject: [PATCH] prepare: install Corepack when the active Node does not ship it 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/prepare/action.yml | 16 ++++++++++++++++ README.md | 8 ++++++++ 2 files changed, 24 insertions(+) diff --git a/.github/actions/prepare/action.yml b/.github/actions/prepare/action.yml index b655b3e..55c8926 100644 --- a/.github/actions/prepare/action.yml +++ b/.github/actions/prepare/action.yml @@ -46,6 +46,22 @@ runs: with: node-version: ${{ inputs.node-version }} + # Node 25 and later no longer ship Corepack. Install it next to the active + # Node when it is missing there. Checking `command -v corepack` is not + # enough: on GitHub's runner images a Corepack from the image's own Node + # stays on PATH, which hides the problem until a job runs in a container + # without one. Node 24 and earlier keep their bundled Corepack untouched. + - name: Install Corepack if Node lacks it + shell: bash + env: + COREPACK_VERSION: '0.36.0' + run: | + node_bin="$(dirname "$(command -v node)")" + if [ ! -x "$node_bin/corepack" ]; then + echo "Node $(node --version) has no Corepack; installing corepack@$COREPACK_VERSION." + npm install --global "corepack@$COREPACK_VERSION" + fi + - name: Enable Corepack for Yarn 4 shell: bash run: corepack enable diff --git a/README.md b/README.md index d92b18a..14c25e1 100644 --- a/README.md +++ b/README.md @@ -462,6 +462,14 @@ and would either fail or silently cache Yarn 1's directory for a Yarn 4 repo. The `yarn-cache` input resolves the folder with `yarn config get cacheFolder` after Corepack instead. +**Node 25 and later do not ship Corepack.** When the active Node has no +`corepack` in its bin directory, the action installs a pinned `corepack` there +with `npm install --global` before enabling it. It checks the bin directory +rather than `PATH` because GitHub's runner images leave a Corepack from their +own Node on `PATH`; a job that runs in a container, such as the Playwright +image, has no such leftover and would fail with `corepack: command not found`. +Node 24 and earlier use their bundled Corepack, as before. + This replaced identical local copies in `truenas/webui` and `truenas-connect/ui` and six inline repetitions in `iXsystems/truenas-ui-components`'s `ci-cd.yml`, which had drifted to a floating `'24'` against the others' pinned `24.13.1`.