Skip to content
Latchkey

pnpm deploy: Usage, Options & Common Errors

Produce a deployable, dependency-bundled copy of a workspace package.

pnpm deploy builds a self-contained directory for a single workspace package, with all its dependencies copied in - so you can ship one package from a monorepo without the rest of the workspace.

What it does

Resolves the target package and its workspace + external dependencies, then writes a standalone directory (real files, not symlinks) you can copy into a production image. It needs to know which package via --filter (older pnpm) or by running from the package with a target path.

Common usage

Terminal
pnpm --filter @acme/api deploy ./out
pnpm deploy --filter=@acme/api --prod ./out
# in a Dockerfile build stage, then COPY ./out into the runtime image

Common CI error: deploy needs a filtered package

pnpm deploy errors because it cannot tell which workspace package to bundle. Specify the package explicitly with --filter (or run from inside the package and give a target dir). In newer pnpm, --legacy may be required to use the classic deploy behavior depending on config.

Terminal
pnpm --filter=@acme/api --prod deploy ./out

Related guides

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