nextjs - 💡(How to fix) Fix create-next-app: Package Manager option doesn't work if pnpm has to be executed via npx [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#86086Fetched 2026-04-08 02:12:38
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Author
Timeline (top)
closed ×1commented ×1labeled ×1locked ×1

Error Message

'pnpm' is not recognized as an internal or external command, operable program or batch file. node:events:496 throw er; // Unhandled 'error' event ^

Error: spawn pnpm ENOENT at notFoundError (C:\Users\user\AppData\Local\npm-cache_npx\cc2145a2fe1558fa\node_modules\create-next-app\dist\index.js:8:51427) at verifyENOENT (C:\Users\user\AppData\Local\npm-cache_npx\cc2145a2fe1558fa\node_modules\create-next-app\dist\index.js:8:51806) at t.emit (C:\Users\user\AppData\Local\npm-cache_npx\cc2145a2fe1558fa\node_modules\create-next-app\dist\index.js:8:51661) at ChildProcess._handle.onexit (node:internal/child_process:293:12) Emitted 'error' event on ChildProcess instance at: at t.emit (C:\Users\user\AppData\Local\npm-cache_npx\cc2145a2fe1558fa\node_modules\create-next-app\dist\index.js:8:51702) at ChildProcess._handle.onexit (node:internal/child_process:293:12) { code: 'ENOENT', errno: 'ENOENT', syscall: 'spawn pnpm', path: 'pnpm', spawnargs: [ 'install' ] }

Node.js v22.15.0

Code Example

'pnpm' is not recognized as an internal or external command,
operable program or batch file.
node:events:496
      throw er; // Unhandled 'error' event
      ^

Error: spawn pnpm ENOENT
    at notFoundError (C:\Users\user\AppData\Local\npm-cache\_npx\cc2145a2fe1558fa\node_modules\create-next-app\dist\index.js:8:51427)
    at verifyENOENT (C:\Users\user\AppData\Local\npm-cache\_npx\cc2145a2fe1558fa\node_modules\create-next-app\dist\index.js:8:51806)
    at t.emit (C:\Users\user\AppData\Local\npm-cache\_npx\cc2145a2fe1558fa\node_modules\create-next-app\dist\index.js:8:51661)
    at ChildProcess._handle.onexit (node:internal/child_process:293:12)
Emitted 'error' event on ChildProcess instance at:
    at t.emit (C:\Users\user\AppData\Local\npm-cache\_npx\cc2145a2fe1558fa\node_modules\create-next-app\dist\index.js:8:51702)
    at ChildProcess._handle.onexit (node:internal/child_process:293:12) {
  code: 'ENOENT',
  errno: 'ENOENT',
  syscall: 'spawn pnpm',
  path: 'pnpm',
  spawnargs: [ 'install' ]
}

Node.js v22.15.0
RAW_BUFFERClick to expand / collapse

https://github.com/vercel/next.js/blob/e5e80ead081db51160551f5ec9f69a83de42fc68/packages/create-next-app/index.ts#L126-L134

There is no option to run any package manager via npx, and as such it breaks the script with an error:

'pnpm' is not recognized as an internal or external command,
operable program or batch file.
node:events:496
      throw er; // Unhandled 'error' event
      ^

Error: spawn pnpm ENOENT
    at notFoundError (C:\Users\user\AppData\Local\npm-cache\_npx\cc2145a2fe1558fa\node_modules\create-next-app\dist\index.js:8:51427)
    at verifyENOENT (C:\Users\user\AppData\Local\npm-cache\_npx\cc2145a2fe1558fa\node_modules\create-next-app\dist\index.js:8:51806)
    at t.emit (C:\Users\user\AppData\Local\npm-cache\_npx\cc2145a2fe1558fa\node_modules\create-next-app\dist\index.js:8:51661)
    at ChildProcess._handle.onexit (node:internal/child_process:293:12)
Emitted 'error' event on ChildProcess instance at:
    at t.emit (C:\Users\user\AppData\Local\npm-cache\_npx\cc2145a2fe1558fa\node_modules\create-next-app\dist\index.js:8:51702)
    at ChildProcess._handle.onexit (node:internal/child_process:293:12) {
  code: 'ENOENT',
  errno: 'ENOENT',
  syscall: 'spawn pnpm',
  path: 'pnpm',
  spawnargs: [ 'install' ]
}

Node.js v22.15.0

For some reason I have Fast Node Manager (fnm) installed and sources as a script in my PowerShell profile. In turn, fnm installed Node.js 22 with npm & npx, and from there I was running npx pnpm without installing it globally.

extent analysis

TL;DR

Install pnpm globally using npm install -g pnpm to resolve the ENOENT error when running npx create-next-app.

Guidance

  • The error occurs because pnpm is not installed globally, and npx cannot find it.
  • Verify that pnpm is not in the system's PATH by running pnpm --version in the terminal.
  • Install pnpm globally using npm install -g pnpm to add it to the system's PATH.
  • Alternatively, consider installing pnpm locally in the project directory using npm install pnpm and then running it using npx pnpm or ./node_modules/.bin/pnpm.

Example

No code snippet is necessary for this issue, as it is a matter of installing a package manager globally.

Notes

The issue is specific to the user's environment, where fnm is installed and pnpm is not. The solution should work for most users with similar setups.

Recommendation

Apply workaround: Install pnpm globally using npm install -g pnpm, as it is a straightforward solution to the ENOENT error.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

nextjs - 💡(How to fix) Fix create-next-app: Package Manager option doesn't work if pnpm has to be executed via npx [1 comments, 2 participants]