pnpm ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL in CI
A pnpm -r (recursive) command ran a script across packages and one of them exited non-zero. pnpm reports the recursive failure; the real error is in that package log.
What this error means
pnpm -r build or test ends with "ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL" naming the package whose script failed, with that package output above.
pnpm
/workspace/packages/api build:
ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL @acme/api@1.0.0 build:
`tsc -b` failed with exit code 2Common causes
A package script failed
One package build or test exited non-zero; the recursive run surfaces it as the first failure.
Build order or missing dep
A package compiled before its dependency, or a missing dependency caused the script to fail.
Environment difference in CI
A script depends on a tool or env present locally but not on the runner.
How to fix it
Read the failing package log
- Open the output of the named package and fix the real error.
Run that package in isolation
- Filter to the failing package to iterate faster.
Terminal
pnpm --filter @acme/api buildHow to prevent it
- Build in topological order and keep package scripts environment-independent so a recursive run does not fail on the runner.
Related guides
Cannot find module from sibling workspace (build order) in CIFix "Cannot find module" from a sibling workspace package in CI. The dependency package was not built before…
Workspace phantom dependency / hoisting error in CIFix workspace phantom dependency errors in CI. Code imported a package it never declared, which works under h…
Lerna bootstrap / run failed in CIFix Lerna bootstrap / run failures in CI. A package script failed during lerna run, or legacy lerna bootstrap…