yarn: not found and corepack: not found on node:lts (Node 26)
Written 10 November 2026
Written 2026-11-10. If a Docker build FROM node:lts, node:lts-slim or node:lts-alpine started stopping at a yarn or corepack step with exit code 127, this is the cause. The short answer: the lts tags have pointed at Node 26 since 2026-10-28, and Node 26 images include neither yarn nor corepack. Install corepack (or yarn) from npm before you use it, or pin the image to node:24.
The error
Built on 2026-11-10 from node:lts-slim (Node 26.13.0, digest 5adad64f9a1f):
#5 0.085 /bin/sh: 1: yarn: not found
ERROR: failed to build: failed to solve: process "/bin/sh -c yarn install --frozen-lockfile" did not complete successfully: exit code: 127
From node:lts-alpine, with RUN corepack enable:
#5 0.080 /bin/sh: corepack: not found
ERROR: failed to build: failed to solve: process "/bin/sh -c corepack enable" did not complete successfully: exit code: 127
The same happens with pnpm when it was meant to come from corepack enable. In a bash step in CI it reads corepack: command not found, also exit code 127.
Why it happens now
Two upstream changes, both merged well before the move:
- corepack. Node.js stopped distributing corepack from Node 25 on ("build: stop distributing Corepack", listed as semver-major in the Node 25.0.0 changelog), and removed it from the release tarballs in nodejs/node#59835.
- yarn. The official images stopped bundling Yarn 1 for Node 26 and later: "Yarn v1 is not bundled into
nodeimages as of Node.js 26.0.0" (docker-node README, from nodejs/docker-node#2422).
Node 26 became LTS on 2026-10-28, and the node:lts tags moved to it that evening. A Dockerfile that has not changed gets the new image on its next build without cache, so the failure can show up days later. Our Node 26 note has the timeline, the other changes (node:lts-slim moved from Debian 12 to 13) and what lts/* means in actions/setup-node.
On 2026-11-10, node:lts-slim and node:lts-alpine both had Node 26.13.0 and npm 11.20.0, and yarn --version and corepack --version both exited 127.
The fixes
Each of these ran on node:lts-slim (Node 26.13.0) on 2026-11-10.
1. Install corepack from npm, then enable it. This keeps packageManager in package.json working. 0.36.0 is the newest corepack on npm (published 2026-08-28) and the version Node 24 bundles. With it, a packageManager of yarn@4.9.2 ran yarn 4.9.2 and pnpm@10.34.6 ran pnpm 10.34.6.
RUN npm install -g corepack@0.36.0 && corepack enable
A public example, merged: fa0311/twitter-snap-bookmarklet#7.
2. Install Yarn 1 from npm. For projects on Yarn classic without packageManager:
RUN command -v yarn >/dev/null || npm install -g yarn@1.22.22
It installed 1.22.22, the newest Yarn 1 on npm. The command -v guard matters if the same Dockerfile also builds on Node 24: those images already have /usr/local/bin/yarn, and a plain npm install -g yarn fails there with EEXIST.
3. Pin Node 24. FROM node:24-slim (or node:24, node:24-alpine) brings back the bundled yarn and corepack. Node 24 is in maintenance and reaches end of life on 2028-04-30 (Node.js release schedule). A public example, merged: FlintSH/Flare#271. This is the smallest change, but the build moves again when you next take an LTS.
In GitHub Actions with actions/setup-node and node-version: lts/*, the same rule applies: run npm install -g corepack@0. before corepack enable, or set node-version: 24.
Find it in your repos
grep -rnE "FROM +node:(lts|current|latest|26)" --include='Dockerfile*' .
grep -rnE "corepack enable|^ *RUN +yarn|yarn install" --include='Dockerfile*' .
A file that matches both, with no npm install -g corepack or npm install -g yarn before the step, fails on its next uncached build. The upgrade canary does a clean build on a new builder and starts the image, so it catches this before a release does.
If this break is in a public repository, we send the fix as a pull request for free; in a private repository it is $300, invoiced after you merge it. To catch the next one before it reaches a release, send your organisation's GitHub name to hello@nonceworks.com and we send back a free report on its public release, publish and nightly workflows (merged fixes, pricing).
Limits
- amd64 only. We ran
node:lts-slimandnode:lts-alpine; the defaultnode:ltsimage isnode:26too, and we did not run it today. - We tested the Yarn 4 and pnpm versions named above through corepack, not every version a
packageManagerfield can ask for.
Sources
- corepack: Node 25.0.0 changelog and nodejs/node#59835.
- yarn: docker-node README and nodejs/docker-node#2422.
- Dates: nodejs/Release schedule.json.
- Versions on npm, read 2026-11-10: corepack 0.36.0, yarn 1.22.22.