Skip to content
Latchkey

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 dev

Common 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 failure

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →