Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
Suppose my package A depends on package B which peer-depends on package C which optionally depends on package D.
As of npm@11.5, npm install does not install D nor write it to the package lock.
This was introduced in #8431, which intended to prune optional peer dependencies. But optional peer dependencies are not the same as optional dependencies of peer dependencies, and this PR as written also affects the latter.
Expected Behavior
npm install should install D, as it did prior to npm@11.5.0.
Steps To Reproduce
- Create a new package A which depends on package B which peer-depends on package C which optionally depends on package D.
- Run
npm install.
- Observe that D does not exist in the package lock or node_modules.
Environment
- npm: 11.5.2
- Node.js: 22.18.0
- OS Name: macOS
- System Model Name: MacBook Pro
- npm config: default
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
Suppose my package A depends on package B which peer-depends on package C which optionally depends on package D.
As of
npm@11.5,npm installdoes not install D nor write it to the package lock.This was introduced in #8431, which intended to prune optional peer dependencies. But optional peer dependencies are not the same as optional dependencies of peer dependencies, and this PR as written also affects the latter.
Expected Behavior
npm installshould install D, as it did prior tonpm@11.5.0.Steps To Reproduce
npm install.Environment