Fix corepack command not found on Node 26 for pnpm and Yarn
Your build stops on its first real line: /bin/sh: 1: corepack: not found, exit code 127. On your laptop it's corepack: command not found, and pnpm and yarn are gone too. Nothing in your repo changed. The Node 26 "corepack not found" error comes from Node itself: Corepack stopped shipping with Node in version 25, and when Node 26 became LTS on October 28, 2026, images and runners that track lts moved to a Node without it.
Node 25 and 26 don't include Corepack anymore, so install it from npm: npm install -g corepack@0.36.0, then corepack enable. That brings back pnpm and yarn and keeps honoring the packageManager field. For a pnpm-only project you can skip Corepack and run npm install -g pnpm@latest, because pnpm reads packageManager itself. If you then see Cannot find module .../pnpm.cjs, run corepack cache clean.
Why is corepack not found on Node 26?
Corepack isn't found on Node 26 because Node.js stopped bundling it in v25.0.0 (released October 15, 2025), so there's no corepack binary next to node anymore. The v25.0.0 changelog lists it as "(SEMVER-MAJOR) build: stop distributing Corepack" (#57617), plus a second commit, "build: remove corepack from release tarballs" (#59835). Neither one made the Notable Changes list at the top of that release post, so it was easy to miss.
The decision goes back to a Node.js TSC vote in March 2025. Corepack stays, still marked experimental, in Node 24 and earlier. The Node 25 Corepack docs say it plainly: "Corepack will no longer be distributed starting with Node.js v25." They point you to "the userland-provided corepack module" instead. The Node 26 docs don't have a Corepack page at all. npm is still bundled, so npm and npx keep working.
Node 25 was an odd-numbered release that never became LTS, and it's already end of life. The break came when the LTS tags moved. Node 26 "Lithium" entered LTS with 26.13.0 (26.13.1 is current), and Docker's node:lts and CircleCI's cimg/node:lts moved from 24 to 26. One comment on CircleCI node-orb issue #260 sums it up: "Node 26.12 was fine, Node 26.13 (LTS) breaks".
Yarn 1 got hit too. The official Docker images say "Yarn v1 is not bundled into node images as of Node.js 26.0.0", so yarn is missing in node:26 images even in projects that never touched Corepack.
The exact error, depending on where you run it
Find your line below. I collected these from public issue threads plus my own lab. The first five mean there's no corepack on PATH. The last two have other causes.
| Where | What you see |
|---|---|
| bash (my lab, Node 25.2.1) | bash: line 1: corepack: command not found, exit 127 |
Debian sh in a Docker build | /bin/sh: 1: corepack: not found, then did not complete successfully: exit code: 127 |
| zsh | (eval):1: command not found: corepack |
| CircleCI | /bin/bash: line 2: corepack: command not found and Exited with code exit status 127 |
| Windows with fnm | '"C:\Users\username\AppData\Roaming\fnm\node-versions\v25.9.0\installation\corepack.cmd"' is not recognized as an internal or external command |
| Netlify, old Corepack | Error: Cannot find module '/opt/buildhome/.cache/node/corepack/v1/pnpm/12.3.4/bin/pnpm.cjs' |
| Railway, at runtime | /bin/bash: line 1: pnpm: command not found |
The Windows one comes from fnm's --corepack-enabled flag, which assumes a bundled corepack.cmd next to node (fnm issue #1554). The Netlify one is different: Corepack is present but too old for pnpm 12. I reproduced it below. The Railway thread never named a cause and was "fixed" by going back to Node 22, which I wouldn't copy.
Three ways to get pnpm and Yarn back
Pick by what your repo uses. If it's Yarn 2 or newer, or a mix of tools, reinstall Corepack from npm. The Corepack README says to remove any global yarn and pnpm first so they don't shadow the shims:
npm uninstall -g yarn pnpm
npm install -g corepack@0.36.0
corepack enable
pnpm --version # inside a project, prints the version from packageManager
For a pnpm-only repo, I'd drop Corepack and install pnpm itself. The pnpm installation page doesn't mention Corepack anymore. It lists npm and a standalone script, and notes that pnpm 12 installed by the script "runs without Node.js":
# through npm (needs Node 18+)
npm install -g pnpm@latest
# or the standalone installer (pin with PNPM_VERSION if you want)
curl -fsSL https://get.pnpm.io/install.sh | sh -
And if you only need one command to run today, npx -y pnpm@12.18.0 install works with nothing installed. A TomTom contributor used the same npx -y pnpm@... trick when their README's corepack enable step broke on Node 26.
| Fix | Covers | Respects packageManager? | When I'd use it |
|---|---|---|---|
npm install -g corepack@0.36.0 | pnpm and Yarn | Yes, Corepack downloads the pinned version | Yarn Berry repos, mixed teams |
npm install -g pnpm@latest | pnpm only | Yes, pnpm switches itself (pmOnFail: download) | pnpm-only laptops and servers |
| Standalone script from get.pnpm.io | pnpm only | Yes, same pnpm logic | Hosts where pnpm shouldn't depend on Node. On Windows, pnpm currently recommends npm instead |
npx -y pnpm@12.18.0 | One pnpm command | You pin it on the command line | Stopgaps, one-off scripts |
pnpm/action-setup@v6 | pnpm in GitHub Actions | Yes, when version is omitted | CI on GitHub |
On npm, pnpm's latest tag pointed at 12.18.0 when I checked. GitHub releases already show 12.21.0, but that's on the next-12 tag. For Yarn 1 in Docker, the image docs suggest npm install --global yarn@1. On older images that still ship Yarn, a plain npm install --global yarn fails with npm error code EEXIST and File exists: /usr/local/bin/yarn.
Does the packageManager field still work without Corepack?
Yes for pnpm, which reads packageManager on its own and, by default, quietly switches to the pinned version. Yarn 2+ is a different story. Yarn's own Corepack page still routes you through Corepack: "running npm install -g corepack before corepack enable should do the trick." I didn't test a Corepack-free Yarn setup, so I won't recommend one.
The pnpm side changed in pnpm 11. The pnpm 11 release notes folded three older settings (managePackageManagerVersions, packageManagerStrict, packageManagerStrictVersion) into one called pmOnFail. It takes four values:
download: the default. Fetch the pinned pnpm and run it.ignore: run whatever pnpm you have, say nothing.warn: run your pnpm and print a warning.error: refuse withERR_PNPM_BAD_PM_VERSION.
If you used COREPACK_ENABLE_STRICT=0 before, the matching pnpm value is warn. If you keep Corepack, mind the field's format. Its README says packageManager@x.y.z is required, the hash is optional "but strongly recommended", and the only permitted names are yarn, npm and pnpm.
I rebuilt pnpm and Yarn on a Node without Corepack
I don't have Node 26 on this server. It runs Node v25.2.1 with npm 11.6.2, and Node 25 is the first line without bundled Corepack, so the missing-binary part behaves the same. I ran everything with an isolated HOME, npm prefix and COREPACK_HOME inside a lab folder, with no Docker and no root-wide installs. The test projects were two tiny package.json files with one dependency, is-number, and a packageManager pin.
The baseline: nothing there
+ node -v
v25.2.1
+ npm -v
11.6.2
+ command -v corepack pnpm yarn
+ echo exit=1
exit=1
+ corepack --version
bash: line 1: corepack: command not found
+ echo exit=127
exit=127
+ pnpm --version
bash: line 1: pnpm: command not found
+ echo exit=127
exit=127
...
+ ls /root/.nvm/versions/node/v25.2.1/bin
node
npm
npx
pm2
pm2-dev
pm2-docker
pm2-runtime
No corepack next to node. (The pm2 entries are a global this server already had.)
Installing Corepack from npm
npm install -g corepack@0.36.0; echo "exit=$?"
ls -l global/bin
command -v corepack pnpm yarn
corepack --version
npm warn EBADENGINE Unsupported engine {
npm warn EBADENGINE package: 'corepack@0.36.0',
npm warn EBADENGINE required: { node: '^22.22.2 || ^24.15.0 || >=26.0.0' },
npm warn EBADENGINE current: { node: 'v25.2.1', npm: '11.6.2' }
npm warn EBADENGINE }
added 1 package in 667ms
+ echo exit=0
exit=0
+ ls -l global/bin
total 0
lrwxrwxrwx 1 root root 45 Nov 13 22:38 corepack -> ../lib/node_modules/corepack/dist/corepack.js
lrwxrwxrwx 1 root root 41 Nov 13 22:38 pnpm -> ../lib/node_modules/corepack/dist/pnpm.js
lrwxrwxrwx 1 root root 41 Nov 13 22:38 pnpx -> ../lib/node_modules/corepack/dist/pnpx.js
lrwxrwxrwx 1 root root 41 Nov 13 22:38 yarn -> ../lib/node_modules/corepack/dist/yarn.js
lrwxrwxrwx 1 root root 44 Nov 13 22:38 yarnpkg -> ../lib/node_modules/corepack/dist/yarnpkg.js
+ command -v corepack pnpm yarn
/opt/blog-pipeline/runs/2026-11-15/lab/global/bin/corepack
/opt/blog-pipeline/runs/2026-11-15/lab/global/bin/pnpm
/opt/blog-pipeline/runs/2026-11-15/lab/global/bin/yarn
+ corepack --version
0.36.0
The EBADENGINE block looks scary but it's only a warning. Corepack's engines range is ^22.22.2 || ^24.15.0 || >=26.0.0, which skips Node 25, and the install still exited 0. Node 26 is inside that range, so the warning shouldn't appear there, though I had no Node 26 to confirm it.
The part I didn't expect: the npm package links pnpm, pnpx, yarn and yarnpkg on install, before any corepack enable. Running corepack enable afterwards changed nothing in that folder. I still keep it in scripts because it costs nothing.
Inside the project pinned to pnpm@12.18.0, the first call downloaded pnpm and the install worked:
+ timeout 120 pnpm --version
! Corepack is about to download https://registry.npmjs.org/pnpm/-/pnpm-12.18.0.tgz
Downloading the pnpm 12.18.0 binary for linux-x64...
12.18.0
real 0m3.823s
...
+ timeout 180 pnpm install
...
dependencies:
+ is-number 7.0.0
Done in 185ms using pnpm v12.18.0
Yarn 4, and the strict-mode trap
The Yarn project pinned to yarn@4.18.1 printed 4.18.1 after a download line and installed cleanly. Then I ran yarn inside the pnpm project, the way you might by accident in a monorepo:
+ cd ../app-pnpm
+ timeout 60 yarn --version
This project is configured to use pnpm because /opt/blog-pipeline/runs/2026-11-15/lab/app-pnpm/package.json has a "packageManager" field
+ echo exit=1
exit=1
+ COREPACK_ENABLE_STRICT=0
+ timeout 120 yarn --version
! Corepack is about to download https://registry.yarnpkg.com/yarn/-/yarn-1.22.22.tgz
1.22.22
+ echo exit=0
exit=0
Turning strict mode off got me Yarn 1.22.22, not Yarn 4. The project has no Yarn pin, so Corepack fell back to its default Yarn. Set COREPACK_ENABLE_STRICT=0 globally to silence that error and you'll be running Yarn 1 in places you didn't expect.
Reproducing the pnpm.cjs error
Next I installed Corepack 0.34.0, the version in the Netlify log, into its own prefix with its own cache, and asked it for pnpm 12.18.0:
+ timeout 120 /opt/blog-pipeline/runs/2026-11-15/lab/old/node_modules/.bin/corepack pnpm --version
node:internal/modules/cjs/loader:1423
throw err;
^
Error: Cannot find module '/opt/blog-pipeline/runs/2026-11-15/lab/home/corepack-old/v1/pnpm/12.18.0/bin/pnpm.cjs'
at Module._resolveFilename (node:internal/modules/cjs/loader:1420:15)
at defaultResolveImpl (node:internal/modules/cjs/loader:1058:19)
...
at process.processTicksAndRejections (node:internal/process/task_queues:88:21) {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Node.js v25.2.1
Same error as the Netlify thread. The downloaded pnpm 12.18.0 only has bin/pnpm.mjs and bin/pnpx.mjs. Old Corepack looks for pnpm.cjs.
The obvious fix is upgrading Corepack. I upgraded that same install to 0.36.0, confirmed corepack --version printed 0.36.0, and ran it again. It failed with the identical Cannot find module ... pnpm.cjs error. The reason was sitting in the cache. Corepack writes a small .corepack file next to each downloaded package manager, recording which bin file to run:
{"locator":{"name":"pnpm","reference":"12.18.0"},"bin":{"pnpm":"./bin/pnpm.cjs","pnpx":"./bin/pnpx.cjs"},"hash":"sha512.9d7882d5dc82147ecfc4e062aa34834e0ad0296710a1837a1115ae012127d36b7109e321ac1598a1dd0a65597681b1e99917e12ed0d749eae91187943363beb3"}
{"locator":{"name":"pnpm","reference":"12.18.0"},"bin":{"pnpm":"./bin/pnpm.mjs","pnpx":"./bin/pnpx.mjs"},"hash":"sha512.9d7882d5dc82147ecfc4e062aa34834e0ad0296710a1837a1115ae012127d36b7109e321ac1598a1dd0a65597681b1e99917e12ed0d749eae91187943363beb3"}
Same tarball hash, different bin entry. New Corepack trusted the old metadata. Clearing the cache fixed it:
+ /opt/blog-pipeline/runs/2026-11-15/lab/old/node_modules/.bin/corepack cache clean
+ echo exit=0
exit=0
+ ls /opt/blog-pipeline/runs/2026-11-15/lab/home/corepack-old
+ cd app-pnpm
+ timeout 120 /opt/blog-pipeline/runs/2026-11-15/lab/old/node_modules/.bin/corepack pnpm --version
Downloading the pnpm 12.18.0 binary for linux-x64...
12.18.0
+ echo exit=0
exit=0
If your CI caches ~/.cache/node/corepack (the default COREPACK_HOME on Linux), a run that fetched pnpm 12 with an old Corepack leaves bad metadata behind. Bump Corepack and change the cache key, or run corepack cache clean once. Otherwise you'll get the same pnpm.cjs error with the new version.
pnpm without Corepack switched versions silently
corepack disable removed all four package manager links, including the ones npm had created, leaving only corepack. After that, npm install -g pnpm@12.18.0 went through with no EEXIST conflict. I didn't try installing pnpm while Corepack's links were still there. Then I made a third project pinned to an older pnpm:
{
"name": "app-pnpm-pinned",
"private": true,
"packageManager": "pnpm@12.17.0",
"dependencies": {
"is-number": "^7.0.0"
}
}
+ pnpm --version
12.18.0
+ cd app-pnpm-pinned
+ timeout 120 pnpm --version
12.17.0
+ echo exit=0
exit=0
+ timeout 180 pnpm install
...
Done in 96ms using pnpm v12.17.0
No message, no prompt. The global 12.18.0 handed off to 12.17.0 because pmOnFail defaults to download. That's usually what you want. I'd rather catch a mismatch in CI, so I added one line to the project:
pmOnFail: error
Now both pnpm --version and pnpm install refuse to run. The --pm-on-fail=warn flag turns it back into a warning for a single command:
+ timeout 60 pnpm --version
Error: ERR_PNPM_BAD_PM_VERSION
× This project is configured to use 12.17.0 of pnpm. Your current pnpm is
│ v12.18.0
help: If you want to bypass this version check, you can set the "pmOnFail"
configuration to "warn" or "ignore" (e.g. via --pm-on-fail=ignore). If
using "devEngines.packageManager", you can set its "onFail" to "warn"
or "ignore"
+ echo exit=1
exit=1
+ timeout 60 pnpm install
Error: ERR_PNPM_BAD_PM_VERSION
...
+ echo exit=1
exit=1
+ timeout 60 pnpm --pm-on-fail=warn --version
[WARN] This project is configured to use 12.17.0 of pnpm. Your current pnpm is v12.18.0
12.18.0
+ echo exit=0
exit=0
npx as a stopgap
With pnpm uninstalled again, npx -y pnpm@12.18.0 --version printed 12.18.0 in 2.708s on a cold npx cache and 0.578s on the second run. That's one run each on one server, so read it as "fine for a script", not as a benchmark.
pnpm on Node 26 in GitHub Actions with setup-node
Install pnpm before actions/setup-node, not after. The setup-node docs say its cache input supports npm, yarn and pnpm, but the "package manager should be pre-installed". Automatic caching from packageManager only applies to npm. Put setup-node first with cache: 'pnpm' and you get issue #1357, "v5 fails immediately when using pnpm". PR #1478, which would skip the cache with a warning instead, was still open when I checked. The example in setup-node's advanced usage docs uses the same order as my workflow:
# NOT RUN in the lab (no GitHub Actions runner here). Order matters:
# pnpm must exist before setup-node tries cache: 'pnpm'.
name: ci
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: pnpm/action-setup@v6 # no version: reads packageManager
- uses: actions/setup-node@v7
with:
node-version: 26
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- run: pnpm test
Leaving out version makes pnpm/action-setup read packageManager or devEngines.packageManager, so the pin lives in one place. The action doesn't install Node, which is why setup-node still comes next. I only checked this file as valid YAML, and I didn't verify the checkout@v5 tag, so treat it as a starting point. If CI is new to you, my GitHub Actions CI/CD guide walks through the workflow file itself.
GitHub's runner images ship with Node 24 preinstalled, which still has Corepack. One project found corepack kept working in a job that targeted Node 26, then broke in a node:26 container (symphony-trello #1118). Run node -v and command -v corepack in the job to see what it really used.
Dockerfile setup for node:26 images
Pin both the base image and Corepack. node:lts moving under you is how this broke in the first place, and an unpinned corepack@latest can do the same thing later. NethServer's fix for their corepack: not found build pins an exact version with a Renovate comment for updates.
# NOT RUN in the lab (no Docker on this server).
FROM node:26-trixie-slim
# Node 25+ no longer ships Corepack: install a pinned version from npm
RUN npm install -g corepack@0.36.0 && corepack enable
ENV COREPACK_ENABLE_DOWNLOAD_PROMPT=0
WORKDIR /app
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
COPY . .
CMD ["pnpm", "start"]
COREPACK_ENABLE_DOWNLOAD_PROMPT=0 stops the ! Corepack is about to download line, which shows up by default whenever you call pnpm or yarn directly. This Dockerfile runs as root. As the node user, corepack enable can fail writing shims into /usr/local/bin (docker-node issue #1732). corepack enable --install-directory with a folder you own that's on PATH gets around it. My Docker basics post covers USER and layer order if those parts are new.
I couldn't build this image because Docker isn't installed here. The Yarn v1 removal and the non-root permission error are from the docs and issues, not my own runs.
When I'd skip Corepack entirely
For a repo that only uses pnpm, I would. pnpm 11 and 12 already do what I wanted Corepack for: read the pin, fetch that version, run it. Adding Corepack on top gives you one more cache that can go stale, and that's exactly what bit me in the lab. pnpm/action-setup in CI and npm install -g pnpm locally is less to think about.
I'd keep Corepack for Yarn Berry projects, since that's still the documented Yarn path. Same for repos where different apps pin different managers. On Windows with fnm, turn off --corepack-enabled for Node 25+, since it expects a bundled binary that no longer exists. The fnm thread has no confirmed fix, so install pnpm through npm, which pnpm already recommends on Windows.
This is the third Node 26 upgrade surprise I've written up. The others were fetch failures from a clashing undici and the module.register() deprecation. If you're moving a whole stack at once, the typescript-eslint ERESOLVE fix may show up in the same PR.
FAQ
Is Corepack deprecated?
Not exactly. Node.js stopped distributing it after a TSC vote in March 2025, and the Node 25 docs still label it Experimental. The tool lives on as a separate npm package: corepack 0.36.0 came out in August 2026 and lists Node 22, 24 and 26 in its engines field. It still works. You just install it yourself now.
How do I install Yarn on Node 26 Docker images?
For Yarn 1, run npm install --global yarn@1, which is what the docker-node README suggests now that Yarn v1 isn't bundled into node images as of Node.js 26.0.0. For Yarn 2 or newer, install a pinned Corepack with npm install -g corepack@0.36.0, run corepack enable, and keep the yarn version in packageManager. I didn't build these images myself.
Do I still need Corepack if my team only uses npm?
No. npm is still bundled with Node 26, so npm-only projects aren't affected. Corepack never managed npm by default anyway, because corepack enable skips the npm shims unless you explicitly ask for them. The only reason to add it would be enforcing an exact npm version from the packageManager field, and most teams don't need that.
How do I verify the integrity of the downloaded package manager?
Pin a hash in the packageManager field, like yarn@3.2.3+sha224.953c... in the Corepack README example. The README calls the hash optional but strongly recommended as a security practice. Without Corepack, pnpm reads the same field, but I didn't test how pnpm treats a hash there, so check that before you rely on it.
How should I update a README that says to run corepack enable?
Change it to npm install -g corepack followed by corepack enable, and add one line explaining that Node 25 and newer don't bundle Corepack. Corepack 0.36.0's engines field also covers Node 24.15 and newer, so contributors on 24 can follow the same steps. For a pnpm-only repo, npm install -g pnpm is simpler, and npx -y pnpm@version helps contributors who can't install global packages.