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] presence of overrides breaks ability to downgrade un-hoisted workspace dependencies #7028

Open
2 tasks done
jenseng opened this issue Nov 27, 2023 · 1 comment
Open
2 tasks done
Labels
Bug thing that needs fixing config:overrides Issues dealing with the overrides feature Release 10.x

Comments

@jenseng
Copy link
Contributor

jenseng commented Nov 27, 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

If the root package.json defines any overrides, if you attempt to downgrade an un-hoisted workspace dependency via the CLI (e.g. npm install <specifierWithOlderVersion> --save-exact -w <workspace>), the command succeeds but nothing actually happens. Note that this only affects downgrades, you can upgrade to a newer version.

Related to #7018 and exacerbated by #7019

Expected Behavior

Invoking the CLI to install a package should either 1. install the package or 2. display an error message explaining why it could not be installed.

Steps To Reproduce

Given package.json:

{
  "workspaces": [
    "packages/*"
  ],
  "overrides": {
    "doesnt-matter-can-be-anything": "1.2.3"
  }
}

And packages/my-cool-package/package.json:

{}

Run:

  1. npm i tiny-invariant@0.0.2 --save-exact -w my-cool-package (hoisted to node_modules/tiny-invariant)
  2. npm i tiny-invariant@0.0.3 --save-exact -w my-cool-package (un-hoisted to packages/my-cool-package/node_modules/tiny-invariant, seemingly due to [BUG] presence of overrides prevents hoisting when updating workspace dependencies #7019)
  3. npm i tiny-invariant@0.0.2 --save-exact -w my-cool-package
  4. Note that 0.0.3 is still installed, and the package*.json files are unchanged since step 2

Environment

  • npm: 10.2.4
  • Node.js: 18.17.1
  • OS Name: Mac OS Ventura
  • System Model Name: Macbook Pro
  • npm config:
registry = "https://registry.npmjs.org/"
@jenseng jenseng added Bug thing that needs fixing Needs Triage needs review for next steps Release 10.x labels Nov 27, 2023
@jenseng jenseng changed the title [BUG] presence of overrides breaks ability to downgrade un-hoisted workspace dependencies [BUG] presence of overrides breaks ability to downgrade un-hoisted workspace dependencies Nov 27, 2023
@alpharder
Copy link

Same here, I'm using workspaces with install-strategy=shallow at .npmrc and any records at overrides are effectively ignored for dependencies of dependencies.

@lukekarrys lukekarrys added config:overrides Issues dealing with the overrides feature and removed Needs Triage needs review for next steps labels May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing config:overrides Issues dealing with the overrides feature Release 10.x
Projects
None yet
Development

No branches or pull requests

3 participants