-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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] unable to resolve dependency tree #2000
Comments
Huh, yeah, that isn't a very helpful explanation, is it? Can you share your package.json file? |
Oh, sorry, you posted repro steps, sorry I'd missed that. Taking a look now. |
Hmm... this seems to work for me using npm 7.0.2 and 7.0.3 (published today). Can you share the full debug log at Also, what git commit are you at in carbonium? Is it possible this has been fixed?
|
Oh, whoops that last install was in npm v6. trying again, I get this:
This is weird, it's not a peer conflict, looks like, it's just refusing to clobber an existing dev dep with a new version. That's a bug, yes. |
Aha, no, it is a peer conflict, but it's failing to properly report on it, because we ignore other edgesIn when the dep node is a dependency of the root node. https://github.com/npm/arborist/blob/main/lib/node.js#L364-L375 I recall that we added that because it got quite noisy in some cases, but it seems clear to me that was a mistake. When that check is removed, I see a report like this, which is much clearer:
If you do |
Ahahhhh... this doesn't have anything to do with the order of the deps. The (second) issue is that both packages have a peer dependency on So, first issue, the report isn't helpful. That's addressed by leaving in the other dependencies when a dep node has an edge coming in from the root package. Easy enough. That would make it clear that you can't simply do Fair enough, so you do Currently that crashes at the phase where it tries to determine of the intended target location has any current dependencies which will collide with one of the peers of the dependency you're trying to add, leading to this loop here. This finds Except... the one we're trying to add also has an This fixes the issue: diff --git a/lib/arborist/build-ideal-tree.js b/lib/arborist/build-ideal-tree.js
index ae9965e..d85d858 100644
--- a/lib/arborist/build-ideal-tree.js
+++ b/lib/arborist/build-ideal-tree.js
@@ -1351,6 +1351,11 @@ This is a one-time fix-up, please be patient...
// only respect valid edges, however, since we're likely trying
// to fix the very one that's currently broken!
if (edge.from === target && edge.valid) {
+ // if we have a replacement in the peerSet that we're trying
+ // to place, and the replacement will be fine, then that's ok.
+ const replacement = dep.parent.children.get(edge.name)
+ if (replacement && replacement.satisfies(edge))
+ continue
canReplace = false
break OUTER
}
Will have a PR up as soon as I have a test for this. Minimized repro case: {
"dependencies": {
"@isaacs/testing-peer-dep-conflict-chain-a": "1",
"@isaacs/testing-peer-dep-conflict-chain-single-a": "^1.0.1",
"@isaacs/testing-peer-dep-conflict-chain-single-b": "^1.0.1"
}
}
|
When in a situation where a project has dependencies on several members of a peer set, it was encountering a spurious ERESOLVE error if the entire set was being replaced, but _one_ of the members did not need to be. For example: ``` root -> (a@1, b@1, c@1) a@1 -> PEER(b@1, c@1) a@2 -> PEER(b@2, c@1) b@1 -> PEER(c@1) b@2 -> PEER(c@1) ``` resulting in the tree: ``` root +-- a@1 +-- b@1 +-- c@1 ``` If we try to upgrade both `a` and `b` to version 2, however, we would check the set of peers for each dependency node being replaced, and find that there was a `c` node with a non-peer dependency from the root node, and treat it as a conflict, even though there was no need for `c` to be modified at all! Resolve this by skipping the check when not doing `canPlacePeers` (since it's either already a conflict, or already set to be overridden by the version from the virtualRoot), and ignoring the conflict when a non-overridden node exists in the virtualRoot which meets the non-peer edge keeping the current dependency node in place. In those cases, either we will replace or keep the current node anyway, so there's no need to conflict on it. Fix: npm/cli#2000
When in a situation where a project has dependencies on several members of a peer set, it was encountering a spurious ERESOLVE error if the entire set was being replaced, but _one_ of the members did not need to be. For example: ``` root -> (a@1, b@1, c@1) a@1 -> PEER(b@1, c@1) a@2 -> PEER(b@2, c@1) b@1 -> PEER(c@1) b@2 -> PEER(c@1) ``` resulting in the tree: ``` root +-- a@1 +-- b@1 +-- c@1 ``` If we try to upgrade both `a` and `b` to version 2, however, we would check the set of peers for each dependency node being replaced, and find that there was a `c` node with a non-peer dependency from the root node, and treat it as a conflict, even though there was no need for `c` to be modified at all! Resolve this by skipping the check when not doing `canPlacePeers` (since it's either already a conflict, or already set to be overridden by the version from the virtualRoot), and ignoring the conflict when a non-overridden node exists in the virtualRoot which meets the non-peer edge keeping the current dependency node in place. In those cases, either we will replace or keep the current node anyway, so there's no need to conflict on it. Fix: npm/cli#2000
When in a situation where a project has dependencies on several members of a peer set, it was encountering a spurious ERESOLVE error if the entire set was being replaced, but _one_ of the members did not need to be. For example: ``` root -> (a@1, b@1, c@1) a@1 -> PEER(b@1, c@1) a@2 -> PEER(b@2, c@1) b@1 -> PEER(c@1) b@2 -> PEER(c@1) ``` resulting in the tree: ``` root +-- a@1 +-- b@1 +-- c@1 ``` If we try to upgrade both `a` and `b` to version 2, however, we would check the set of peers for each dependency node being replaced, and find that there was a `c` node with a non-peer dependency from the root node, and treat it as a conflict, even though there was no need for `c` to be modified at all! Resolve this by skipping the check when not doing `canPlacePeers` (since it's either already a conflict, or already set to be overridden by the version from the virtualRoot), and ignoring the conflict when a non-overridden node exists in the virtualRoot which meets the non-peer edge keeping the current dependency node in place. In those cases, either we will replace or keep the current node anyway, so there's no need to conflict on it. Fix: npm/cli#2000
I am trying to deploy my app on a Heroku dyno and I am experiencing this same/similiar error. This has just started to happen and the proposed solution I am not sure how to try on a Heroku Dyno, or if it is even a proper fix. Any help would be appreciated as I need to push out an update to our app and I am not quote sure how to correct this issue. |
The same issue installing an angular app in Dotnet project.
|
Yes, I do not understand why this is closed when there is no global solution for this. Since you are angular botnet,. it appears to be a real npm issue. I was hoping someone here would be able to shed some light upon this as it just started happening. I noticed it when I mistakenly re-deployed my project which has not changed in months. And now this, however, I went to publish the correct app with some changes and it refuses to let me deploy because of this. Very frustrating since obviously others have the issue. If you find something that you feel may help me also I would love to hear. |
Of course, the temporary solution is using prior versions of the node. Here is the link for downloading. |
Wow, yes, I used 14.13.1 and my app deploys fine. No errors! Thank you, you are a life saver I was fooling with this for hours yesterday and today. I tried various versions to no success. Anyway, I am still puzzled why my default install fails with the default Heroku version of npm. Anyway, I am glad it is resolved for me. Thanks again! |
Happy that helped. |
Thank you so much! You saved my life 😅 |
- Fixes npm/cli#2000
Same issue on Circle CI with
Downgrading node to |
- Fixes npm/cli#2000
FYI, this seems to be an issue I'm getting on the out-of-the-box Typescript Repro steps:
@isaacs It seems like the issue is fixed via npm/arborist@1d6b057. Is there a way to track when that gets released in an npm release? |
Also having this issue after upgrading to Node 15.0.1 and npm 7.0.5. |
@strican It's in @npmcli/arborist 1.0.4, which is included in npm 7.0.4 https://github.com/npm/cli/releases. This issue has gotten quite a few "me too" comments that are in fact different examples, with different versions of npm in some cases. Please post new issues for problems that occur with different packages, or using different versions of npm. The original post here has been root-caused, addressed, and verified fixed. If you are in fact having the same problem, then the solution is to update to the latest release of npm, where this issue is fixed. If you are having a different issue with the same error code, with different packages, using the latest version of npm, then please post a new issue. We cannot get to the bottom of your problem any other way. Thus, I am lovingly and compassionately locking this issue, to force y'all to actually get help from us <3 |
Current Behavior:
When I run
npm i @typescript-eslint/parser@latest
, I get:Expected Behavior:
I expect npm to upgrade my package. Npm says "Fix the upstream dependency conflict", but I don't see any.
If npm sees a conflict, it should explain where the conflict is.
Steps To Reproduce:
Environment:
MacOS 10.15.7
Node v15.0.0
npm 7.0.2
The text was updated successfully, but these errors were encountered: