-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
False negative peer dependency warning when using aliases #8934
Description
Verify latest release
- I verified that the issue exists in the latest pnpm release
pnpm version
9.15.2
Which area(s) of pnpm are affected? (leave empty if unsure)
CLI
Link to the code that reproduces this issue or a replay of the bug
Reproduction steps
Using the reproduction repo:
pnpm --filter "./*" exec pnpm pack- For sake of reproduction, simple pack of trivial packages is easiest. But in real world, these packages would probably already be published to npm.
pnpm i- Note the warning messages about "missing peer" (there is also an "unmet peer" warning. This is not the topic of the issue, and does not recreate when using npm instead of tgz)
d
└─┬ c 0.0.1
└─┬ b 0.0.1
└── ✕ missing peer a@file:../a/a-0.0.1.tgz
Peer dependencies that should be installed:
a@file:../a/a-0.0.1.tgz
pnpm --filter "./d" exec node ./d.js- logs:
{ c: { b: { a: 'A' } } } - The command is successful! So the peer dependency must actually exist, and therefore be a false positive.
- logs:
Alternatively, add these two packages to a package.json of your choice and run installation:
"nx": "20.3.0",
"nx-update-ts-references": "0.1.1"
(See issue recreation for in-depth explanation of why these packages recreate the issue)
Describe the Bug
When pnpm installs packages:
- "a", any package your chose
- "b", a package that depends on "a" as a peer dependency
- "c", a package that depends on "b", and fulfills the peer dependency of a but uses an alias
- "d", a package that depends on "c"
It will flag the "d" installation (not the c!) that it's internal dependency of b->a is not satisfied.
However this is a false negative. The peer dependency is successfully fulfilled, and all code executes as it should!
Expected Behavior
No warning should show up during installation.
The peer dependency is successfully fulfilled (based on pnpm's install setup in node_modules/.pnpm), so this is really a non-issue.
Note that the actual install setup and resolution paths should not be updated, there is no noticeable issue with those. It is simply the warning that happens during install that is the issue.
Which Node.js version are you using?
v22.12.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)
debian