-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Open
Labels
Bugthing that needs fixingthing that needs fixingPriority 2secondary priority issuesecondary priority issue
Description
Is there an existing issue for this?
- I have searched the existing issues
This issue exists in the latest npm version
- I am using the latest npm
Current Behavior
Given a project with package A version X installed.
Given a package B having an optional peer dependency on package A version Y.
When installing package B, npm tries to install A version Y. If X and Y are incompatible versions, the install fails.
Additionnaly, the install still fails when explicitly passing --omit=optional.
Expected Behavior
Optional dependencies, including optional peer dependencies, should not be installed, especially when they would cause a conflict with already-installed packages.
Previous discussion
See issue #2615 which was supposed to solve the exact same problem in npm version 7.5.5, apparently the fix has been reverted since then.
Also see broader discussion here, and there.
Steps To Reproduce
- In an Angular project version 21 (at least 21.2.2 reproduces the problem)
- Run
npm install parliamentarch@3.1.0, ornpm install parliamentarch@3.1.0 --omit=optional - See error
Conflicting peer dependency: jsdom@25.0.1
Environment
- OS Name: Windows
- System Model Name: 11
- npm config:
; node version = v24.12.0
; npm version = 11.10.0
; Run `npm config ls -l` to show all defaults.(private information omitted)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Bugthing that needs fixingthing that needs fixingPriority 2secondary priority issuesecondary priority issue