You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
autoDedupe does not work when downgrading a dependency in one package that is a peer dependency of another #16432
With autoDedupe enabled, we'd expect the final pnpm dedupe to be a no-op, but the deduplication doesn't happen after pnpm add.
Describe the Bug
We have two packages in the monorepo. Package a has a dependency "@cerbos/embedded-server": "0.7.2", package b has a peer dependency "@cerbos/embedded-server": "^0.7.1".
When we run pnpm --filter=./packages/a add @cerbos/embedded-server@0.7.1 to downgrade the dependency, with autoDedupe enabled my expectation is that we end up only having one version of the dependency installed (0.7.1).
In reality, we end up with both 0.7.1 and 0.7.2 installed. Running pnpm dedupe solves this, but we wouldn't expect to have to do so with autoDedupe enabled.
Expected Behavior
pnpm add deduplicates dependencies when autoDedupe is enabled.
Which Node.js version are you using?
v26.10.0
Which operating systems have you used?
macOS
Windows
Linux
If your OS is a Linux based, which one it is? (Include the version if relevant)
Thanks for the clear reproduction. A fix is open in #16438 and covers the whole issue.
Two things kept 0.7.2 around:
When autoDedupe found both versions, it dropped the extra preference that a's exact 0.7.1 spec gives that version. The two versions tied, and ties go to the highest version. pnpm dedupe keeps that preference, which is why it picked 0.7.1.
pnpm --filter=./packages/a add wrote back b's old lockfile entry, because b was outside the filter. With autoDedupe on, projects outside the filter now get their deduplicated entries too.
After the fix, your reproduction ends with only @cerbos/embedded-server@0.7.1 in the lockfile, whether b has it as a peer dependency or a regular one.
Written by an agent (Claude Code, claude-opus-5-5).
Activity
zkochan commentedon Sep 30, 2026
Thanks for the clear reproduction. A fix is open in #16438 and covers the whole issue.
Two things kept 0.7.2 around:
autoDedupefound both versions, it dropped the extra preference thata's exact0.7.1spec gives that version. The two versions tied, and ties go to the highest version.pnpm dedupekeeps that preference, which is why it picked 0.7.1.pnpm --filter=./packages/a addwrote backb's old lockfile entry, becausebwas outside the filter. WithautoDedupeon, projects outside the filter now get their deduplicated entries too.After the fix, your reproduction ends with only
@cerbos/embedded-server@0.7.1in the lockfile, whetherbhas it as a peer dependency or a regular one.Written by an agent (Claude Code, claude-opus-5-5).
fix(deps): update dependencias no-major (#23)
chore(deps): update pnpm to v12.9.0
chore(deps): update pnpm to v12.9.0
chore(deps): update pnpm to v12.9.0
chore(deps): update pnpm to v12.9.0
chore(deps): update pnpm to v12.9.0