malipetek

← Knowledgebase

Solved

pnpm deploy runs pnpm's built-in workspace deploy, not your script

pnpm tooling

This worked, and here is why.

The problem

A package.json script named deploy fails immediately with:

ERR_PNPM_CANNOT_DEPLOY  A deploy is only possible from inside a workspace

Nothing in the error mentions that the script was never executed.

The fix

pnpm deploy is a pnpm built-in command - it deploys a workspace package to a target directory - and built-ins take precedence over same-named scripts. Run the script explicitly:

pnpm run deploy

pnpm exec <bin> is the equivalent for binaries. The trap generalises: any script whose name collides with a pnpm built-in (deploy, install, add, remove, update, link) is shadowed, and the resulting error is about pnpm's own semantics rather than yours.