-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Inconsistent lockfile changes on repeat installs #7444
Comments
@stevenpetryk are these the same issues that you were looking into? |
@zkochan we have observed the exact same two things ( My hypothesis with all three behaviors is that they're some sort of race condition during resolution, but I haven't spent any time debugging yet. |
@alex-statsig in any case, you should upgrade to pnpm v8. We only ship security patches to pnpm v7. |
Thanks, we are working on it but just having some trouble keeping versions pinned during the upgrade (some typescript errors introduced, mostly from mui, which doesn't seem correct) |
@alex-statsig Can you give me access to your large project? I only need the |
Sure, the repo as a whole is private; what's a good way to send you those files? |
I only need the pnpm related files (like |
We are also observing this with v7.33.6 in a large monorepo. Seeing inconsistency in @types/node and ts-node, but also other dependencies as well. |
Oh, this is a complex scenario. |
After all, I don't think changing |
Unfortunately this one will be hard to fix. The peers resolution algorithm will have to go through some heavy refactoring. And this will be a breaking change. But it is important to fix it. I will try to do it in v9. This happens when peer dependencies have peer dependencies of its own. I thought I have fixed it in #7583 but no, the problem requires a much bigger rewrite. |
The fix is ready for review: #7606 |
…7606) close #7444 Peer dependencies of peer dependencies are now resolved correctly. When peer dependencies have peer dependencies of their own, the peer dependencies are grouped with their own peer dependencies before being linked to their dependents. For instance, if `card` has `react` in peer dependencies and `react` has `typescript` in its peer dependencies, then the same version of `react` may be linked from different places if there are multiple versions of `typescript`. For instance: ``` project1/package.json { "dependencies": { "card": "1.0.0", "react": "16.8.0", "typescript": "7.0.0" } } project2/package.json { "dependencies": { "card": "1.0.0", "react": "16.8.0", "typescript": "8.0.0" } } node_modules .pnpm card@1.0.0(react@16.8.0(typescript@7.0.0)) node_modules card react --> ../../react@16.8.0(typescript@7.0.0)/node_modules/react react@16.8.0(typescript@7.0.0) node_modules react typescript --> ../../typescript@7.0.0/node_modules/typescript typescript@7.0.0 node_modules typescript card@1.0.0(react@16.8.0(typescript@8.0.0)) node_modules card react --> ../../react@16.8.0(typescript@8.0.0)/node_modules/react react@16.8.0(typescript@8.0.0) node_modules react typescript --> ../../typescript@8.0.0/node_modules/typescript typescript@8.0.0 node_modules typescript ``` In the above example, both projects have `card` in dependencies but the projects use different versions of `typescript`. Hence, even though the same version of `card` is used, `card` in `project1` will reference `react` from a directory where it is placed with `typescript@7.0.0` (because it resolves `typescript` from the dependencies of `project1`), while `card` in `project2` will reference `react` with `typescript@8.0.0`.
Verify latest release
pnpm version
7.33.5 (latest-7), as well as 7.32.4 and 7.28.0
Which area(s) of pnpm are affected? (leave empty if unsure)
Lockfile
Link to the code that reproduces this issue or a replay of the bug
No response
Reproduction steps
Hard to create a consistent repro, it occurs with a large project. One example dependency which triggers it is
jest-config@29.6.1(@types/node@16.11.58)(ts-node@10.9.1)
. It seems the peer version of @types/node changes across installs.Describe the Bug
Repeat installs cause several inconsistent changes to the lockfile:
Ex. on one install I get the following lockfile section:
On another install, I get the following:
The only difference is
ts-node: 10.9.1(@types/node@16.11.22)(typescript@4.8.4)
changing tots-node: 10.9.1(@types/node@16.9.2)(typescript@4.8.4)
Expected Behavior
Lockfile should not change for a consistent version of pnpm. This causes lots of pain with merge conflicts as the lockfile thrashes back and forth in many PRs.
Which Node.js version are you using?
v16.17.1
Which operating systems have you used?
If your OS is a Linux based, which one it is? (Include the version if relevant)
No response
The text was updated successfully, but these errors were encountered: