pnpm add: Add Dependencies
pnpm add installs a package and updates the manifest.
pnpm add supports monorepo targeting with --filter, but like other add commands it belongs in PRs, not CI.
Common flags
-D- devDependency-E- exact version--filter <pkg>- add to one workspace-w- add to the workspace root
Example
Add a dev tool to one workspace package.
shell
pnpm add -D -E --filter @app/web vitestIn CI
Running pnpm add in CI mutates the lockfile and breaks --frozen-lockfile. Keep it to local development.
Key takeaways
--filtertargets a workspace.-wadds to the root.- Do not run
pnpm addin CI.