npm / npm/cli

[BUG] list omit dev not respected for linked dependencies'

Open
#6,658 1 comment 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug cmd:list Priority 2 Release 9.x
Dominant language
JavaScript
Stars
10.1k
Forks
4.7k
Avg merge
2d 2h
Merged PRs (30d)
19

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
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.

main@1.0.0 E:\code\main
├── dep1@1.0.0
└─┬ dep2@1.0.0 -> .\..\dep2
  ├── dep3@1.0.0
  └── dep4@1.0.0
Expected Behavior
main@1.0.0 E:\code\main
├── dep1@1.0.0
└─┬ dep2@1.0.0 -> .\..\dep2
  └── dep3@1.0.0

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is named. Reproduce the linked-dependency package layout and run npm list --all --omit dev; then trace the CLI handling of linked dependencies. Done means the output includes dep3 but excludes dep4, matching the expected tree.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.