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] overrides doesn't replace all instances of dependency #4322

Closed
2 tasks done
melink14 opened this issue Jan 25, 2022 · 4 comments
Closed
2 tasks done

[BUG] overrides doesn't replace all instances of dependency #4322

melink14 opened this issue Jan 25, 2022 · 4 comments
Assignees
Labels
Bug thing that needs fixing Priority 1 high priority issue Release 8.x work is associated with a specific npm 8 release

Comments

@melink14
Copy link

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

Override replaces some but not all instances of overriden dependency. In this example, I have a dependency on a package which has a dependency on npm which contains a vulnerable version of ansi-regex. I tried to fix this via an override but npm audit still complains and searching through package-lock.json shows various version numbers before my overriden value.

Expected Behavior

According to docs, overrides should ensure all installed instances of a dependency conform to the given value so I expect my override version 5.0.1 only to exist.

Steps To Reproduce

  1. Clone https://github.com/melink14/rikaikun
  2. Modify package.json with:
"overrides": {
    "ansi-regex": "5.0.1",
  },
  1. Delete package-lock.json and run npm install
  2. Run npm audit and see that vulnerable older versions of ansi-regex still exist..

Environment

  • npm: 8.3.2
  • Node.js: 16
  • OS Name: WSL Pengwin
  • System Model Name:
  • npm config:
; node bin location = /home/espeed/n/bin/node
; cwd = /home/espeed/projects/rikaikun
; HOME = /home/espeed
; Run `npm config ls -l` to show all defaults.
@melink14 melink14 added Bug thing that needs fixing Needs Triage needs review for next steps Release 8.x work is associated with a specific npm 8 release labels Jan 25, 2022
@dbjorge
Copy link

dbjorge commented Feb 9, 2022

Probably a duplicate of #4232

@melink14
Copy link
Author

I didn't think it was a dupe of #4232 since that one was specifically about needing to delete package-lock.json to get any updates to happen. This issue was even if you do that, the updates are incomplete.

They could probably be merged if the other issue was updated to be more broad.

@fritzy fritzy added Priority 1 high priority issue and removed Needs Triage needs review for next steps labels Feb 17, 2022
@nlf nlf self-assigned this Mar 1, 2022
@melink14
Copy link
Author

melink14 commented Apr 3, 2022

In 8.6, after deleting package-lock.json and node_modules it seems like everything got removed correctly.

Not sure if it's supposed to be able to update a legacy tree to a new tree but hopefully it will be fine going forward now.

@nlf
Copy link
Contributor

nlf commented Apr 4, 2022

closing as this should be fixed as of npm@8.6.0

if anyone continues to encounter this problem, feel free to open a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Priority 1 high priority issue Release 8.x work is associated with a specific npm 8 release
Projects
None yet
Development

No branches or pull requests

4 participants