-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Description
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
If there is a prod dependency installed from the local filesystem and it has dev dependencies, npm ls --depth=Infinity
returns also dev dependencies although it doesn't do this for dependencies installed from the public NPM registry. Depth parameter value doesn't matter - it just has to be more than 0.
It worked fine in npm v6.
Expected Behavior
All dev dependencies except direct ones (depth=0) should not be listed when calling npm ls --depth=Infinity
Steps To Reproduce
- Create an NPM project
- Configure a local prod dependency, let's call it "A"
- Add a local dev dependency to the package "A", let's call it "AX"
- Install dependencies:
npm install
- Type
npm ls --depth=Infitnity
- Notice the "AX" package it also listed
My example
Explanation: all packages ending with "X" in the name are dev dependencies and they shouldn't be listed the same way as dev dependencies of "adm-zip" package aren't. The "x" package is a dev dependency but it's a direct dependency of the module so it should (and is, correctly) be listed.
adm-zip's package.json file from node_modules (an evidence that is has dev dependencies and they weren't listed):
Environment
- OS: macOS Catalina 10.15.7
- Node: 16.5.0
- npm: 7.19.1