The shell says pnpm: command not found
pnpm: command not foundShort answer
The shell cannot find a pnpm executable on PATH. Either pnpm was never installed, it was installed but its folder is not on PATH yet, or you relied on Corepack, which Node.js no longer bundles from version 25. Check with which pnpm, then install pnpm, run pnpm setup, or install Corepack.
Fix it fast
1Find out which cause you have
Find out whether any pnpm is on PATH, and which Node.js you run. The answers split the three causes.
which pnpm; echo "exit: $?" node --version echo "$PATH" | tr ':' '\n' | head -n 202Match what you see, then jump to its fix
- 1
which pnpm prints nothing, and you have never run an installer on this machinepnpm was never installedFix - 2
The install finished without errors, but pnpm is still not found in the same terminalpnpm is installed, but its folder is not on PATHFix - 3
node --version is 25 or newer, and corepack enable fails or corepack is not foundYou relied on Corepack, which your Node.js does not includeFix
- 1
What does the error look like?
pnpm: command not foundnpx next dev works, but pnpm dev or pnpm install is not found
Cause 1 of 3
pnpm was never installed
1Check
pnpm is a separate tool. A fresh machine or a new container has no pnpm until you install it.
command -v pnpm || echo 'pnpm not on PATH'2Fix
Use the standalone installer, or npm if Node.js is already there. The npm global install needs Node.js 18 or newer.
# standalone script, no Node.js needed
curl -fsSL https://get.pnpm.io/install.sh | sh -
# or, with Node.js 18+
npm install -g pnpm@latest3Verify
Open a new terminal and ask for the version.
pnpm --versionConfirmed by pnpm.io
Cause 2 of 3
pnpm is installed, but its folder is not on PATH
1Check
pnpm setup creates the pnpm home directory and adds it to PATH by updating your shell configuration file. If it cannot tell which shell file to change, it prints the PNPM_HOME and PATH lines for you to add by hand.
echo "$PNPM_HOME"2Fix
Run the setup command, then open a new shell so the change is read.
pnpm setup
exec "$SHELL" -l3Verify
pnpm resolves from any folder.
command -v pnpmConfirmed by pnpm.io
Cause 3 of 3
You relied on Corepack, which your Node.js does not include
1Check
Corepack is distributed with Node.js from 14.19.0 up to, but not including, 25.0.0. corepack enable creates the pnpm and Yarn shims on your path.
command -v corepack; node --version2Fix
On Node.js 25 and later, install Corepack with npm first, then enable the pnpm shim. Remove any global pnpm binary before this, as the Corepack readme advises.
npm install -g corepack
corepack enable pnpm3Verify
The shim answers, and a project with a packageManager field gets the version it names.
pnpm --versionConfirmed by github.com
How do I stop it coming back?
- Put the install step in your setup script or Dockerfile, not in someone's memory.
- Pin the tool in package.json with the packageManager field so Corepack uses one version for everyone.
- After any install that edits shell files, open a new terminal before testing.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
Related fixes
Web apps
npm start runs, but the browser does not refresh when you save a file
Saving a file does nothing while npm start is running
The watcher behind npm start is not seeing your edit.
4 causes, each with a fixWeb apps
django-tailwind cannot find the npm executable (cPanel, Windows, Linux)
CommandError raised by the tailwind management command about npm
django-tailwind runs npm as a subprocess, and Python sometimes cannot find it.
3 causes, each with a fixWeb apps
Node.js fails with uv_cwd ENOENT when its folder is gone
npm, node or next fails at start in a terminal whose folder was removed
uv_cwd is how Node.js asks the operating system for its current working directory.
2 causes, each with a fixWeb apps
Playwright cannot open a headed browser on a Linux server or in Docker
npx playwright test --headed shows no window on a Linux server
A headed browser needs a display, and a Linux server or container has none.
3 causes, each with a fixWeb apps
Vite build stops with [vite:load-fallback] Could not load a file
ENOENT: no such file or directory
The message names two files: the one Vite could not read and the file that imports it.
2 causes, each with a fixWeb apps
tsconfig rejects allowImportingTsExtensions
An error that allowImportingTsExtensions needs noEmit or emitDeclarationOnly
allowImportingTsExtensions lets files import each other with .ts or .tsx extensions, and TypeScript only allows it together with noEmit or emitDeclarationOnly.
2 causes, each with a fix