-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
Verify latest release
- I verified that the issue exists in the latest pnpm release
pnpm version
9.14.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
https://github.com/47hao/pnpm-issue-repro
Reproduction steps
- Enable
strict-peer-dependencies - Introduce a peer dependency issue; for example, have the following in
package.json:
"dependencies": {
"react": "18.2.0",
"react-dom": "16.9.0"
}
- Address the peer dependency issue using
peerDependencyRules, such as by adding this snippet to thepackage.json. UsingallowAnyshould also work, based onstrict-peer-dependenciesin combination withpnpm.peerDependencyRules.allowAnysuppresses error message but exit code is 1 #8382
"pnpm": {
"peerDependencyRules": {
"allowedVersions": {
"react-dom@16>react": "18"
}
}
}
- Run
pnpm install. Nothing is logged, the "Done in X" success message is missing, and the exit code is 1.

Describe the Bug
During a pnpm install, where strict-peer-dependencies is enabled and peer dependency issues are fixed via peerDependencyRules:
- All direct peer issues, before considering
peerDependencyRules, are aggregated inpeerDependencyIssuesByProjects - A peer dependency error is thrown because
peerDependencyRulesis not empty. - The errors are rendered, during which
peerDependencyRulesare parsed and applied. That fixes all the peer dependency issues, so the error rendering function outputs nothing.
The observed outcome is exit code 1 (due to step 2) and no error logging (due to step 3).
This bug is new to pnpm v9+ because peerDependencyRulesare now only considered when logging; before, they were applied as patches. #7758 moved the effects of peerDependencyRules from upstream of the error throw to downstream of it.
Related issues:
- Peer deps issue errors are not reported #7978
strict-peer-dependenciesin combination withpnpm.peerDependencyRules.allowAnysuppresses error message but exit code is 1 #8382
Expected Behavior
pnpm install succeeds with exit code 0.
The processing logic for peer dependency errors (currently in the render function) should run before throwing a PeerDependencyIssuesError, and the error throw should be conditioned on its result.
Which Node.js version are you using?
18.18.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)
No response