pnpm: set the overrides but it looks like not work
pnpm version:
6.17.0
Code to reproduce the issue:
Recently, out project change from yarn to pnpm because of its speed. But when I install the modules, I find it not like what we expected.(Maybe I think the overrides property is like yarn resolution) Here is the package.json code
{
"dependencies": {
"@editor-kit/core": "3.37.0-rc.0"
}
"pnpm": {
"overrides": {
"@editor-kit/core": "3.37.0-rc.0"
}
}
}
Here is the node_modules Topology in .pnpm folder after pnpm install

Also in pnpm-lock.yaml file, I find the same version package(@editor-kit/core) with different hash.
Expected behavior:
Just one package will be install when I set the overrides
Actual behavior:
Many package, and these package have same version with different hash. Really expecting a reply!
Additional information:
Old and large project, there is too much dependencies
node -vprints: 14.16.0- Windows, macOS, or Linux?: macOS
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 15
- Comments: 20 (2 by maintainers)
It would be great having this work for workspaces
It seems counterintuitive that overrides would not work for workspaces because I was under the impression that workspaces can be used as a feature to coordinate a monorepo containing multiple applications and not just multiple packages. For example I might have the structure:
and my
pnpm-workspace.yamllooks like thisIt seems advantageous in a large monorepo where apps are owned by different teams that dependency overrides could be specified at the app workspace level. For example if
app-aandapp-bboth depended uponlib-awhich is consumed as a workspace and not as a published package, iflib-ahasreactas a dependency, andapp-awants to upgrade toreact@18whereasapp-bwants to stay onreact@17it would seem useful to be able to specify app workspace leveloverridesrather than global overrides at the rootpackage.jsonlevel. I’m wondering what you would suggest as best practice here @zkochan if it would be better forlib-ato specifyreactas apeerDependencyor if there is a way to specify package versions for specific workspaces using something like the PNPM hooks?Seems like one potential solution in yarn for this is no-hoist
Note that overrides seem to be ignored in workspaces. If you use workspaces, what will help is if you move overrides to the root
package.json(possibly create empty one first).您好,我已收到您的邮件,我会尽快给您回复。
Any update/solution found?
您好,我已收到您的邮件,我会尽快给您回复。
您好,我已收到您的邮件,我会尽快给您回复。
Hello, I believe I’m also running into this issue. (Or quite possibly I’m misunderstanding how overrides work)
I’m seeing the override set in both
package.jsonandpnpm-lock.yamlafter runningpnpm audit --fix, andpnpm install, however the version of the dependency in the lockfile still shows the old version (in this case minimist 1.2.5), but the override is asking for>=1.2.6. A few other dependencies have the same problem.Running
pnpm auditshows no vulns tho.TLDR: it seems overrides are not being applied to
pnpm-lock.yaml您好,我已收到您的邮件,我会尽快给您回复。
root folder package.json
pnpm-lock.yaml after
pnpm installstill broken for workspaces