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
path: root/lib
diff options
context:
space:
mode:
authorRuy Adorno <ruyadorno@hotmail.com>2021-04-22 01:43:05 +0300
committerRuy Adorno <ruyadorno@hotmail.com>2021-04-22 16:58:13 +0300
commit2aecec591df6866e27d0b17dc49cef8f7d738d77 (patch)
treee3e8a2ac5b1192be9e37496a0cd97ea62ef7d00d /lib
parentc4ff4bc113c3a5b6ee5d74ab0b1adee95169ed32 (diff)
fix: npm ls --long missing deps
Running `npm ls --json --long --all` was broken for any project containing a missing dependency from the node_modules folder. This fixes it by avoiding trying to read the extra data required by the --long option in case a dependency is missing. Fixes: https://github.com/npm/cli/issues/2724 PR-URL: https://github.com/npm/cli/pull/3119 Credit: @ruyadorno Close: #3119 Reviewed-by: @wraithgar
Diffstat (limited to 'lib')
-rw-r--r--lib/ls.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/ls.js b/lib/ls.js
index 56d657945..a6f3fbcd9 100644
--- a/lib/ls.js
+++ b/lib/ls.js
@@ -305,7 +305,7 @@ const getJsonOutputItem = (node, { global, long }) => {
if (node.isRoot && hasPackageJson)
item.name = node.package.name || node.name
- if (long) {
+ if (long && !node[_missing]) {
item.name = item[_name]
const { dependencies, ...packageInfo } = node.package
Object.assign(item, packageInfo)