Your Dockerfile has run corepack enable for two years, nothing in it changed, and then the base image moved to Node 26 and the install stage dies on line one with sh: 1: corepack: not found. The short version: Corepack stopped being distributed with Node.js at v25, so node:26-bookworm-slim carries no corepack binary at all, and the official images dropped Yarn v1 separately at 26.0.0. Run npm install -g corepack@latest && corepack enable if you actually need the shims, and skip Corepack entirely for Yarn Classic and for pnpm.
This is landing in November rather than last autumn because Node 26 reached Active LTS on 28 October 2026, which pointed node:lts and lts/* at a runtime with no Corepack for everyone pinned to a floating tag, the same mechanism as node:lts moving without a commit.
What I read to write this: the Node.js v25 Corepack doc, which states that Corepack will no longer be distributed starting with Node.js v25 and points users at the userland module; PR nodejs/node#59835 ("build: remove corepack from release tarballs", merged 12 September 2025, landed as 22a864a), the commit that emptied the tarball; and the earlier #57617 ("build: stop distributing Corepack"), labelled semver-major and closed unmerged. Any assistant trained before those landed will still tell you Corepack ships with Node, and pnpm's install page no longer mentions Corepack at all.
Which binary is missing decides which fix applies:
The fixes, in the order I apply them
- Probe the image for the binary; never infer it from
node -v. A version string tells you which release you pulled, not what that build contains, and vendored or distro-patched images get it wrong in both directions. I hit the same shape earlier this year on an EOL Node 20 box where the version string lied and only a behavioural probe gave the real answer.
docker run --rm node:26-bookworm-slim sh -c 'node -v; command -v corepack yarn pnpm || echo MISSING'
On node:26-bookworm-slim that prints the version and then MISSING. Use command -v rather than corepack --version: the first exits non-zero, which a CI gate can read, while the second exits 127 with a shell error and no usable signal.
- Treat the missing Corepack and the missing Yarn as separate incidents. Corepack left upstream Node at v25. Yarn v1 left the Docker images at 26.0.0, which the docker-node README states plainly ("Yarn v1 is not bundled into
nodeimages as of Node.js 26.0.0") and which was tracked as docker-node issue #2407, closed by PR #2422. If you are on Yarn Classic you do not need Corepack back, and the README's own answer isnpm install --global yarn@1. - Install Corepack from npm in the documented order, uninstall first. The manual-install sequence in the Corepack README starts with a removal, and that step is load-bearing: a global
yarnorpnpmalready on PATH collides with the shims Corepack is about to write.
RUN npm uninstall -g yarn pnpm \
&& npm install -g corepack@latest \
&& corepack enable
- Know where
corepack enableputs the shims after a userland install. Corepack detects where it is installed and creates the shims next to itself, so they now land in your npm global bin rather than beside thenodebinary. In an image that runs as a non-root user, or one with a relocated global prefix, that directory may not be on the PATH of the stage running the install. Name the target explicitly withcorepack enable --install-directory /usr/local/bin. - Do not pin an old Corepack in the name of reproducibility. Releases before 0.31.0 lack the signing keys npm rotated to, so they fail against current package-manager releases with
Error: Cannot find matching keyid, the subject of corepack#612. Pin a lower bound instead:npm install -g corepack@^0.31. When a thread tells you to setCOREPACK_INTEGRITY_KEYS=0, read what it does first, because the README describes it as instructing Corepack to skip integrity checks, which means turning off signature verification on a tarball you then execute. - Install the package manager in the stage that runs it, not only in the builder. Each
FROMresets/usr/local/bin, so a multi-stage Dockerfile can pass CI and then fail on boot. Railpack logged exactly that in issue #563: the build succeeded and the runtime died onpnpm: command not found. If your entrypoint shells out topnpmoryarn, the final stage needs the binary too. - For pnpm, stop going through Corepack at all. The current pnpm installation page documents no Corepack path: it gives
curl -fsSL https://get.pnpm.io/install.sh | sh -, a pinned variant withenv PNPM_VERSION=<version>,npx get-pnpm, andnpm install -g pnpm@latest, and existing installs from 11.10.0 upward takepnpm self-update. Two version details worth carrying:lateston npm points at the pnpm 12 line, andPNPM_NO_MODIFY_PATH=1requires 12.16.0 or newer, the release that also changed how pnpm applies umask to the store. - Keep
packageManager, but accept that nothing installs from it any more. The field is still the right place to record the intended version, and tools such as Turborepo read it. Yarn Classic will still reportThis project's package.json defines "packageManager": "yarn@4.2.2". However the current global version of Yarn is 1.22.21.and then recommendcorepack enable, which on Node 26 is advice for a binary that is not installed. Install the pinned version yourself and let the field document it. - Mind the
devEngines.packageManagertrap withonFail: "error". Teams walk into this while fixing the Corepack one, and with that setting even commands that install nothing abort:
npm error code EBADDEVENGINES
npm error EBADDEVENGINES Invalid devEngines.packageManager
npm error EBADDEVENGINES Invalid semver version "^11.10.0" does not match "10.9.7" for "packageManager"
That output comes from npm config get cache, which actions/setup-node runs during cache discovery, reported against v6.4.0 in setup-node#1553 and still open. The maintainer workaround is package-manager-cache: false; the durable fix is choosing a node-version whose bundled npm already satisfies the range, instead of relaxing the declaration to onFail: "warn" and losing the check.
- Verify your runner rather than assuming it matches your image. One row here I could not settle from a primary source: whether the current
ubuntu-26.04hosted runner image still carries a globalyarnorcorepackoutside the toolcache. Third-party toolset diffs report Yarn Classic 1.22.22 present, and nothing I read addresses Corepack either way, so settle it inside your own workflow.ubuntu-latestfinished moving to Ubuntu 26.04 on 19 November, which means an answer you remember from October may already be stale.
- run: command -v corepack yarn pnpm || true
- Add a tripwire so the next floating tag does not re-break it. One grep finds every caller still issuing the dead instruction, and it is cheap enough to run on each PR.
grep -rn 'corepack enable' --include='Dockerfile*' --include='*.yml' . && echo 'review: Node >= 25 has no corepack'
Pair it with an assertion inside the image build itself, RUN command -v pnpm after the install step, so a missing package manager fails the layer that was supposed to provide it rather than the container at 3 a.m.
Wrap-up
Every wrong fix in the threads above starts by reasoning from a version number to a binary's existence: Corepack ships with Node, Yarn ships in the node image, the runner has what the laptop has. All three were true for years, and two of them stopped being true on dates nobody in your repo wrote down. Run command -v against the image you actually ship, in the stage that actually runs it.
docker run --rm node:lts sh -c 'command -v corepack yarn pnpm || echo MISSING'
Comments
Be the first to comment.