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 not working as expected in workspace #4205

Closed
2 tasks done
kturney opened this issue Jan 3, 2022 · 4 comments · Fixed by #4339
Closed
2 tasks done

[BUG] overrides not working as expected in workspace #4205

kturney opened this issue Jan 3, 2022 · 4 comments · Fixed by #4339
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

@kturney
Copy link

kturney commented Jan 3, 2022

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

I am attempting to use the overrides support shipped in 8.3 within a project that also uses workspaces, but the dependency package version is not being overridden as expected.

My reading of the overrides RFC leads me to believe that maybe overrides is not currently supported within workspaces? If such is the case, then this may just be a documentation issue. Or maybe I am not correctly identifying the "root package.json file for a project" mentioned in the RFC.

I have tried placing my overrides in both the workspace's package.json and the package's package.json.
But none of these have successfully caused the package-lock.json to be generated with the overridden version after I run a fresh npm i from the workspace root.

If I add the overrides to the package's package.json and run npm i from within the package's directory, then the overrides functionality works as expected, but I lose the workspace functionality.

Expected Behavior

Given this workspace tree

workspace/
  a/
    ...
    package.json
  b/
    ...
    package.json
  package-lock.json
  package.json

in the package.json of package b (and where b has a dependency on node-zopfli) I expect to be able to put either

"overrides": {
  "prebuild-install": "^7.0.0"
},

or

"overrides": {
  "node-zopfli": {
    "prebuild-install": "^7.0.0"
  }
},

to cause prebuild-install@7 to be used instead of node-zopfli's request for prebuild-install@^5.3.5.
And I expect the package-lock.json in workspace to reflect this override.

Steps To Reproduce

  1. In this environment...
  2. With this config...
  3. Run '...'
  4. See error...

Environment

  • npm: 8.3.0
  • Node: 17.3.0
  • OS: macOS
  • platform: MacBook Pro
  • npm config:
; "user" config from /Users/kyle.turney/.npmrc

registry = "https://registry.npmjs.org/"

; "project" config from /Users/kyle.turney/dev/dc-flutter/lab_packages/.npmrc

audit = false
engine-strict = true
fund = false

; node bin location = /Users/kyle.turney/.volta/tools/image/node/17.3.0/bin/node
; cwd = /Users/kyle.turney/dev/dc-flutter/lab_packages
; HOME = /Users/kyle.turney
; Run `npm config ls -l` to show all defaults.
@kturney kturney 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 3, 2022
@nlf nlf added Priority 1 high priority issue and removed Needs Triage needs review for next steps labels Jan 4, 2022
@nlf nlf self-assigned this Jan 4, 2022
@nlf
Copy link
Contributor

nlf commented Jan 4, 2022

workspace support for overrides is incomplete and untested, this is something that we'll be working on soon though!

@arnoudius
Copy link

Facing the same issue, would be nice if support could be added for this

@nukeop
Copy link

nukeop commented Jul 10, 2024

Is this completed? There is this issue: #4834

And it looks like it's still not working in the latest npm version.

@jehy
Copy link

jehy commented Aug 1, 2024

Still not working :(

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

Successfully merging a pull request may close this issue.

5 participants