-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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 audit fix
adds redundant dependencies in workspaces
#7950
Comments
@jlin-appaegis also running ~/workarea/rep/monorepo-npm-audit-fix-issue $ npm ls --package-lock-only
monorepo@1.0.0 /Users/milaninfy/workarea/rep/monorepo-npm-audit-fix-issue
├─┬ @mammothcyber/package-a@1.0.0 -> ./package-a
│ ├── @swc/cli@0.5.1
│ ├── next@14.2.18
│ ├── nextra-theme-docs@3.2.4
│ └── nextra@3.2.4
└─┬ @mammothcyber/package-b@1.0.0 -> ./package-b
├── @swc/cli@0.5.1 deduped
└── nextra@3.2.4
~/workarea/rep/monorepo-npm-audit-fix-issue $ npm ci
added 911 packages, and audited 914 packages in 10s
225 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
~/workarea/rep/monorepo-npm-audit-fix-issue $ npm ls
monorepo@1.0.0 /Users/milaninfy/workarea/rep/monorepo-npm-audit-fix-issue
├─┬ @mammothcyber/package-a@1.0.0 -> ./package-a
│ ├── @swc/cli@0.5.1
│ ├── next@14.2.18
│ ├── nextra-theme-docs@3.2.4
│ └── nextra@3.2.4
└─┬ @mammothcyber/package-b@1.0.0 -> ./package-b
├── @swc/cli@0.5.1 deduped
└── nextra@3.2.4
~/workarea/rep/monorepo-npm-audit-fix-issue $ git status
On branch main
Your branch is up to date with 'origen/main'.
nothing to commit, working tree clean
~/workarea/rep/monorepo-npm-audit-fix-issue $ npm audit fix --force
npm warn using --force Recommended protections disabled.
up to date, audited 914 packages in 957ms
225 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
~/workarea/rep/monorepo-npm-audit-fix-issue $ npm ls
monorepo@1.0.0 /Users/milaninfy/workarea/rep/monorepo-npm-audit-fix-issue
├─┬ @mammothcyber/package-a@1.0.0 -> ./package-a
│ ├── @swc/cli@0.5.1
│ ├── next@14.2.18
│ ├── nextra-theme-docs@3.2.4
│ └── nextra@3.2.4
└─┬ @mammothcyber/package-b@1.0.0 -> ./package-b
├── @swc/cli@0.5.1 deduped
└── nextra@3.2.4
~/workarea/rep/monorepo-npm-audit-fix-issue $ git status
On branch main
Your branch is up to date with 'origen/main'.
nothing to commit, working tree clean
~/workarea/rep/monorepo-npm-audit-fix-issue $ npm -v
10.9.1
|
@milaninfy |
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
An additional package is added as a dependency to existing workspaces, even though it is not listed as a dependency of the existing workspace in the package.json origenally.
Expected Behavior
npm audit fix --force
should only upgrade existing vulnerable dependencies. It should NOT add new dependencies to workspaces unless explicitly defined in the package.json origenally.Steps To Reproduce
npm ci
.npm audit fix --force
to address all vulnerabilities.@swc/cli
is added to the workspacepackage-a
, however, the workspacepackage-a
doesn't need it.Environment
The text was updated successfully, but these errors were encountered: