Skip to content

[BUG] npm ls --prod is not omitting dev deps of workspaces #3382

Description

@ruyadorno

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Running npm ls --production is not omitting dev deps of child workspaces, e.g:

# Given a workspace structure:
.
├── a
│   └── package.json (devDependencies: abbrev@^1.1.1)
├── b
│   └── package.json
└── package.json

# Running default list:
$ npm ls
test-ls-workspaces-dev@1.0.0 <path>/test-ls-workspaces-dev
├─┬ a@1.0.0 -> ./a
│ └── abbrev@1.1.1
└── b@1.0.0 -> ./b

# Running prod-only list:
$ npm ls --prod
test-ls-workspaces-dev@1.0.0 <path>/test-ls-workspaces-dev
├─┬ a@1.0.0 -> ./a
│ └── abbrev@1.1.1
└── b@1.0.0 -> ./b

Expected Behavior

# Given a workspace structure:
.
├── a
│   └── package.json (devDependencies: abbrev@^1.1.1)
├── b
│   └── package.json
└── package.json

# Running prod-only list:
$ npm ls --prod
test-ls-workspaces-dev@1.0.0 <path>/test-ls-workspaces-dev
├── a@1.0.0 -> ./a
└── b@1.0.0 -> ./b

Steps To Reproduce

  1. In an properly configured workspaces project
  2. Run npm ls --prod
  3. Should not be seeing dev deps of child workspaces

Environment

  • Node: v16.3.0
  • npm: v7.16.0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingRelease 7.xwork is associated with a specific npm 7 release

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions