pnpm run: Usage, Options & Common Errors
Run scripts in one package or across the workspace.
pnpm run executes a named script from package.json. Add -r to run it across every workspace package, or --filter to target a subset.
What it does
Runs the named script with node_modules/.bin on PATH. -r (recursive) runs it in every workspace package that defines it, in topological order; --filter narrows to matching packages. Args after the script are passed through.
Common usage
Terminal
pnpm run build # run build in this package
pnpm build # "run" is optional for non-builtins
pnpm -r run test # run test in every workspace
pnpm --filter @acme/web run devCommon CI error: recursive run fails on one package
pnpm -r run build aborts because one workspace package fails to build. By default pnpm stops on the first failure. Use --filter to isolate the failing package, or pass --no-bail to keep going and collect all failures in one CI run.
Terminal
pnpm -r --no-bail run build # don't stop at the first failureRelated guides
pnpm "ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL" in CIFix pnpm "ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL" in CI - a recursive workspace script failed in one package, fail…
pnpm recursive (-r): Usage & Common ErrorsThe pnpm -r / --recursive flag runs a command across every workspace package in topological order. Usage, --f…
npm run: Usage, Options & Common CI ErrorsHow npm run executes package.json scripts, passing args with --, and the "missing script" error that fails CI…