This repository has been archived by the owner on Jan 20, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not conflict on meta-peers that will not be replaced
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
- Loading branch information