/
snap
/
node
/
11691
/
lib
/
node_modules
/
npm
/
lib
/
utils
/
/snap/node/11691/lib/node_modules/npm/lib/utils
mkdir
upload
Name
Size
Mode
Actions
audit-error.js
1045
0644
edit
dl
rm
auth.js
3291
0644
edit
dl
rm
cmd-list.js
2959
0644
edit
dl
rm
completion.fish
1596
0644
edit
dl
rm
completion.sh
1898
0755
edit
dl
rm
did-you-mean.js
1188
0644
edit
dl
rm
display.js
15749
0644
edit
dl
rm
error-message.js
15150
0644
edit
dl
rm
explain-dep.js
3648
0644
edit
dl
rm
explain-eresolve.js
2617
0644
edit
dl
rm
format-bytes.js
629
0644
edit
dl
rm
format-search-stream.js
4808
0644
edit
dl
rm
format.js
1957
0644
edit
dl
rm
get-identity.js
802
0644
edit
dl
rm
get-workspaces.js
1748
0644
edit
dl
rm
installed-deep.js
1129
0644
edit
dl
rm
installed-shallow.js
583
0644
edit
dl
rm
is-windows.js
177
0644
edit
dl
rm
log-file.js
7971
0644
edit
dl
rm
npm-usage.js
2064
0644
edit
dl
rm
open-url.js
2414
0644
edit
dl
rm
output-error.js
767
0644
edit
dl
rm
ping.js
262
0644
edit
dl
rm
queryable.js
9785
0644
edit
dl
rm
read-user-info.js
1956
0644
edit
dl
rm
reify-finish.js
886
0644
edit
dl
rm
reify-output.js
5788
0644
edit
dl
rm
sbom-cyclonedx.js
5331
0644
edit
dl
rm
sbom-spdx.js
4696
0644
edit
dl
rm
tar.js
3552
0644
edit
dl
rm
timers.js
2120
0644
edit
dl
rm
update-workspaces.js
1013
0644
edit
dl
rm
validate-lockfile.js
1023
0644
edit
dl
rm
verify-signatures.js
12226
0644
edit
dl
rm
Edit:
/snap/node/11691/lib/node_modules/npm/lib/utils/explain-eresolve.js
(2617B)
// this is called when an ERESOLVE error is caught in the exit-handler, // or when there's a log.warn('eresolve', msg, explanation), to turn it // into a human-intelligible explanation of what's wrong and how to fix. const { explainEdge, explainNode, printNode } = require('./explain-dep.js') // expl is an explanation object that comes from Arborist. It looks like: // Depth is how far we want to want to descend into the object making a report. // 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, chalk, depth) => { const { edge, dep, current, peerConflict, currentEdge } = expl const out = [] const whileInstalling = dep && dep.whileInstalling || current && current.whileInstalling || edge && edge.from && edge.from.whileInstalling if (whileInstalling) { out.push('While resolving: ' + printNode(whileInstalling, chalk)) } // 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, chalk)) } else if (peerConflict && peerConflict.current) { out.push('Found: ' + explainNode(peerConflict.current, depth, chalk)) } else if (currentEdge) { out.push('Found: ' + explainEdge(currentEdge, depth, chalk)) } else /* istanbul ignore else - should always have one */ if (edge) { out.push('Found: ' + explainEdge(edge, depth, chalk)) } out.push('\nCould not resolve dependency:\n' + explainEdge(edge, depth, chalk)) if (peerConflict) { const heading = '\nConflicting peer dependency:' const pc = explainNode(peerConflict.peer, depth, chalk) out.push(heading + ' ' + pc) } return out.join('\n') } // generate a full verbose report and tell the user how to fix it const report = (expl, chalk, noColorChalk) => { const flags = [ expl.strictPeerDeps ? '--no-strict-peer-deps' : '', '--force', '--legacy-peer-deps', ].filter(Boolean) const or = (arr) => arr.length <= 2 ? arr.join(' or ') : arr.map((v, i, l) => i + 1 === l.length ? `or ${v}` : v).join(', ') const fix = `Fix the upstream dependency conflict, or retry this command with ${or(flags)} to accept an incorrect (and potentially broken) dependency resolution.` return { explanation: `${explain(expl, chalk, 4)}\n\n${fix}`, file: `# npm resolution error report\n\n${explain(expl, noColorChalk, Infinity)}\n\n${fix}`, } } module.exports = { explain, report, }
Save
cmd:
run