Is there an existing issue for this?
This issue exists in the latest npm version
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
- In this environment...
- With this config...
- Run '...'
- 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.
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
I am attempting to use the
overridessupport shipped in 8.3 within a project that also usesworkspaces, but the dependency package version is not being overridden as expected.My reading of the overrides RFC leads me to believe that maybe
overridesis not currently supported withinworkspaces? 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
overridesin both the workspace'spackage.jsonand the package'spackage.json.But none of these have successfully caused the
package-lock.jsonto be generated with the overridden version after I run a freshnpm ifrom the workspace root.If I add the
overridesto the package'spackage.jsonand runnpm ifrom within the package's directory, then theoverridesfunctionality works as expected, but I lose the workspace functionality.Expected Behavior
Given this workspace tree
in the
package.jsonof packageb(and wherebhas a dependency onnode-zopfli) I expect to be able to put eitheror
to cause
prebuild-install@7to be used instead ofnode-zopfli's request forprebuild-install@^5.3.5.And I expect the
package-lock.jsoninworkspaceto reflect this override.Steps To Reproduce
Environment