Skip to content

[BUG] npm ci --omit-dev is not omitting dev dependencies of child workspaces when conflicting with root #6441

@Rayyan98

Description

@Rayyan98

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

When using workspaces, having a dev dependency which has one version in root and a different conflicting version inside a workspace folder and running npm ci --omit=devit will ignore dev deps present in the root package.json but install dev dependencies for the child workspaces.

I found an issue relating to it here but it was back in version 7 and has been fixed as well apparently.

Expected Behavior

Using omit=dev should not install dev deps for root or any child workspace

Steps To Reproduce

  1. Using npm version 9.6.6
  2. Create a project with a sub folder which is also a workspace in the root package json. Added some dev dependency to the root package json and some different version of the dev dependency to the package json inside the sub folder so that it conflicts and is not hoisted
  3. Run npm ci --omit=dev from root or npm ci --omit=dev from inside the sub folder or npm ci --omit=dev --workspace <package-name-in-package-json-in-subfolder> from either folder
  4. The dev dependency inside subfolder will get installed

Repo with minimum reproducible example: https://github.com/Rayyan98/npm-issue

Environment

  • npm: 9.6.6
  • Node.js: 18.14.1
  • OS Name: Mac OS
  • System Model Name: -
  • npm config:
; node bin location = /Users/rayyanulhaq/.nvm/versions/node/v18.14.1/bin/node
; node version = v18.14.1
; npm local prefix = /Users/rayyanulhaq/Work/rewaa/simple
; npm version = 9.6.6
; cwd = /Users/rayyanulhaq/Work/rewaa/simple
; HOME = /Users/rayyanulhaq
; Run `npm config ls -l` to show all defaults.```

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingNeeds Triageneeds review for next stepsRelease 9.xwork is associated with a specific npm 9 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions