npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

Installing a package with a mismatching peer dependency causes the peer dependency to disappear from npm ls

Copying from: https://github.com/npm/npm/issues/21100

I’m opening this issue because:

What’s going wrong?

Installing a package with a mismatching peer dependency causes the peer dependency to disappear from npm ls. The package still exists in node_modules and the binary in node_modules/.bin.

How can the CLI team reproduce the problem?

➜ Projects mkdir jest-test
➜ Projects cd jest-test
➜ jest-test npm init
yes to all…
➜ jest-test npm i -D jest
➜ jest-test npm ls jest
jest-test@1.0.0 /Users/ville.lahdenvuo/Projects/jest-test
└── jest@23.2.0
all good so far…
➜ jest-test npm i -D jest-preset-angular
npm WARN jest-preset-angular@5.2.3 requires a peer of @angular/core@>=2.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN jest-preset-angular@5.2.3 requires a peer of @angular/platform-browser-dynamic@>=2.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN jest-preset-angular@5.2.3 requires a peer of jest@^22.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN jest-zone-patch@0.0.8 requires a peer of zone.js@>=0.7.5 but none is installed. You must install peer dependencies yourself.
npm WARN ts-jest@22.4.6 requires a peer of typescript@2.x but none is installed. You must install peer dependencies yourself.

➜ jest-test npm ls jest
jest-test@1.0.0 /Users/ville.lahdenvuo/Projects/jest-test
└── (empty)
what? the dependency is gone because it doesn’t match the peer dependency???

This is very confusing to me, is it by design?

supporting information: