cli
cli copied to clipboard
[BUG] list omit dev not respected for linked dependencies'
Is there an existing issue for this?
- [X] I have searched the existing issues
This issue exists in the latest npm version
- [X] I am using the latest npm
Current Behavior
npm list --all --omit dev
It displays only the production and peer dependencies (as you would expect), except if you have a dependency that is linked
The linked dependency will list not just the production ones, but ALSO it's dev ones too.
[email protected] E:\code\main
├── [email protected]
└─┬ [email protected] -> .\..\dep2
├── [email protected]
└── [email protected]
Expected Behavior
[email protected] E:\code\main
├── [email protected]
└─┬ [email protected] -> .\..\dep2
└── [email protected]
Note the exclusion of dep4, as it's a devDependencies and should be omitted.
Steps To Reproduce
main
{
"name": "main",
"dependencies": {
"dep1": "^1.0.0",
"dep2": "^1.0.0"
}
}
dep1
{
"name": "dep1",
}
dep2
Package with 1 dependency dep3 and 1 dev-dependency dep4
{
"name": "dep2",
"dependencies": {
"dep3": "^1.0.0"
},
"devDependencies": {
"dep4": "^1.0.0"
}
}
dep3
Simple package
{
"name": "dep3",
}
dep4
Simple package
{
"name": "dep4",
}
Run
npm list --all --omit dev
Environment
- npm: 9.6.6
- Node.js: 20.2.0
- OS Name: Windows 10
- System Model Name: ..... Computer ???
- npm config:
; node bin location = C:\nodejs\node.exe
; node version = v20.2.0
; npm local prefix = E:\code\main
; npm version = 9.6.6
; cwd = E:\code\main
; HOME = C:\Users\WORMSS
; Run `npm config ls -l` to show all defaults.
Seeing the same thing. I made a repro on https://github.com/tmm1/npm-ls-bug
❯ node --version
v22.15.1
❯ npm --version
10.9.2
❯ cat package.json
{
"name": "npm-ls-bug",
"version": "1.0.0",
"dependencies": {
"utils": "file:./packages/utils"
}
}
❯ cat packages/utils/package.json
{
"name": "utils",
"version": "1.0.0",
"devDependencies": {
"@swc/core": "1.13.5"
}
}
❯ npm ls --all --omit=dev
[email protected]
└─┬ [email protected] -> ./packages/utils
└─┬ @swc/[email protected]
├── @swc/[email protected]
├── UNMET OPTIONAL DEPENDENCY @swc/[email protected]
├── UNMET OPTIONAL DEPENDENCY @swc/[email protected]
├── UNMET OPTIONAL DEPENDENCY @swc/[email protected]
├── UNMET OPTIONAL DEPENDENCY @swc/[email protected]
├── UNMET OPTIONAL DEPENDENCY @swc/[email protected]
├── UNMET OPTIONAL DEPENDENCY @swc/[email protected]
├── UNMET OPTIONAL DEPENDENCY @swc/[email protected]
├── UNMET OPTIONAL DEPENDENCY @swc/[email protected]
├── UNMET OPTIONAL DEPENDENCY @swc/[email protected]
├── @swc/[email protected]
├── UNMET OPTIONAL DEPENDENCY @swc/helpers@>=0.5.17
└─┬ @swc/[email protected]
└── @swc/[email protected] deduped