Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2021-07-28 03:01:07 +0300
committerGar <gar+gh@danger.computer>2021-07-29 17:40:10 +0300
commit66dc5f94dfb5bc99c715e075cde1ab9c1ec84a83 (patch)
treec5da89ae7a00399aee8def492f830b0d744c481d /lib/utils/explain-eresolve.js
parent97cb5ec312e151527ba2aab77ed0307917e1d845 (diff)
fix: update eresolve explanations for new arborist data provided
Fix: #3138 PR-URL: https://github.com/npm/cli/pull/3588 Credit: @isaacs Close: #3588 Reviewed-by: @wraithgar
Diffstat (limited to 'lib/utils/explain-eresolve.js')
-rw-r--r--lib/utils/explain-eresolve.js15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/utils/explain-eresolve.js b/lib/utils/explain-eresolve.js
index fa3c6bda5..b25e3e4a9 100644
--- a/lib/utils/explain-eresolve.js
+++ b/lib/utils/explain-eresolve.js
@@ -9,26 +9,33 @@ const { explainEdge, explainNode, printNode } = require('./explain-dep.js')
// The full report (ie, depth=Infinity) is always written to the cache folder
// at ${cache}/eresolve-report.txt along with full json.
const explain = (expl, color, depth) => {
- const { edge, current, peerConflict, currentEdge } = expl
+ const { edge, dep, current, peerConflict, currentEdge } = expl
const out = []
- if (edge.from && edge.from.whileInstalling)
- out.push('While resolving: ' + printNode(edge.from.whileInstalling, color))
+ const whileInstalling = dep && dep.whileInstalling ||
+ current && current.whileInstalling ||
+ edge && edge.from && edge.from.whileInstalling
+ if (whileInstalling)
+ out.push('While resolving: ' + printNode(whileInstalling, color))
// it "should" be impossible for an ERESOLVE explanation to lack both
// current and currentEdge, but better to have a less helpful error
// than a crashing failure.
if (current)
out.push('Found: ' + explainNode(current, depth, color))
+ else if (peerConflict && peerConflict.current)
+ out.push('Found: ' + explainNode(peerConflict.current, depth, color))
else if (currentEdge)
out.push('Found: ' + explainEdge(currentEdge, depth, color))
+ else /* istanbul ignore else - should always have one */ if (edge)
+ out.push('Found: ' + explainEdge(edge, depth, color))
out.push('\nCould not resolve dependency:\n' +
explainEdge(edge, depth, color))
if (peerConflict) {
const heading = '\nConflicting peer dependency:'
- const pc = explainNode(peerConflict, depth, color)
+ const pc = explainNode(peerConflict.peer, depth, color)
out.push(heading + ' ' + pc)
}