npm / npm/cli

[BUG] `npm audit fix` installes incompatible peer dependencies

Open
#9,724 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Priority 2
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
This is not just a request to bump a dependency for a CVE
  • This is not solely a request to bump a dependency for a CVE
Current Behavior

I run npm audit fix, npm warns about "npm warn ERESOLVE overriding peer dependency"

Expected Behavior

Run the npm audit fix subcommand to automatically install compatible updates to vulnerable dependencies.

(Highlight by me)

https://docs.npmjs.com/auditing-package-dependencies-for-security-vulnerabilities?ref=content-for-engineers-by-engineers-atomist-blog#security-vulnerabilities-found-with-suggested-updates

Steps To Reproduce

package.json

package-lock.json

Run npm audit fix

Environment
  • npm: 11.16.0
  • Node.js: v24.18.0
  • OS Name: Debian forky/sid
  • System Model Name: N/A
  • npm config:
; "builtin" config from /usr/share/nodejs/npm/npmrc

prefix = "/usr/local"

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

Reproduce the report with the attached package.json and package-lock.json by running npm audit fix, and capture the ERESOLVE warning and resulting dependency changes. Trace how the audit fix command selects updates and resolves peer dependencies; done means vulnerable dependencies are updated without installing incompatible peer dependencies.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
cli, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.