Skip to content

PNPM warns about unmet peer dep when aliased #11126

Description

@maxpatiiuk

Verify latest release

  • I verified that the issue exists in the latest pnpm release

pnpm version

10.33.0

Which area(s) of pnpm are affected? (leave empty if unsure)

Dependencies resolver

Link to the code that reproduces this issue or a replay of the bug

https://github.com/maxpatiiuk/pnpm-aliased-peer-warning

Reproduction steps

  1. Clone this repository

    git clone https://github.com/maxpatiiuk/pnpm-aliased-peer-warning
    cd pnpm-aliased-peer-warning
  2. Go into b/

    cd b
    
  3. Install dependencies

    pnpm
    

    See the warning.

Describe the Bug

PNPM warns about unmet peer dependency when a dependency is coming from outside the workspace, and it declares a peer dependency using an npm: alias syntax.

The warning only happens only on the first pnpm call or if you changed dependencies:

~/s/e/pnpm-aliased-peer/b main *❯ pnpm
Packages: +2
++
Progress: resolved 2, reused 2, downloaded 0, added 2, done
 WARN  Issues with peer dependencies found
.
└─┬ a 1.0.0
  └── ✕ unmet peer tslib-aliased@npm:tslib@^2.8.1: found 2.8.1

dependencies:
+ a 1.0.0
+ tslib-aliased <- tslib 2.8.1

Done in 354ms using pnpm v10.32.1
~/s/e/pnpm-aliased-peer/b main *❯ pnpm
Lockfile is up to date, resolution step is skipped
Already up to date
Done in 229ms using pnpm v10.32.1

Expected Behavior

The warning is not expected - both tslib and tslib-aliased are declared as dependencies.

Not reproducible if the package in question (a/) comes from the current workspace, or uses a relative file path instead of a tarball.

I am using tslib just as an example. Reproducible with other deps.

Workaround:

Add this in pnpm-workspace.yaml:

peerDependencyRules:
  allowedVersions:
    "tslib-aliased": "2.8.1"

Which Node.js version are you using?

v24.14.1

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)

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions