Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
2 tasks done
Rayyan98 opened this issue May 10, 2023 · 1 comment · Fixed by #6549
Closed
2 tasks done
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 9.x work is associated with a specific npm 9 release

Comments

@Rayyan98
Copy link
Contributor

Rayyan98 commented May 10, 2023

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.```
@Rayyan98 Rayyan98 added Bug thing that needs fixing Needs Triage needs review for next steps Release 9.x work is associated with a specific npm 9 release labels May 10, 2023
@Rayyan98
Copy link
Contributor Author

Rayyan98 commented Jun 9, 2023

I have found that this happens because the filter in the picture below inside the arborist package returns false due to node.top.isProjectRoot being false for dev dependencies that lie inside a work space. If anyone could instruct me whether changing the filter condition to something like (top.isProjectRoot or top.isRootOfAWorkSpace) would be the correct approach then i could take this up

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 9.x work is associated with a specific npm 9 release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant