Skip to content
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] the --long command is not giving expected results #2724

PhilipAbed opened this issue Feb 18, 2021 · 2 comments

[BUG] the --long command is not giving expected results #2724

PhilipAbed opened this issue Feb 18, 2021 · 2 comments


Copy link

@PhilipAbed PhilipAbed commented Feb 18, 2021

Current Behavior:

im trying to run these flags:
C:\tests\projects\npm\npm7LsSS>npm ls --all --json --long
`npm ERR! Cannot destructure property 'dependencies' of 'node.package' as it is undefined.
"error": {
"code": null,
"summary": "Cannot destructure property 'dependencies' of 'node.package' as it is undefined.",
"detail": ""

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\PhilipAbed\AppData\Local\npm-cache_logs\2021-02-18T15_01_37_387Z-debug.log`

  1. the --long --json --all parameters were giving me "_deduped" field in the json result.. now it doesnt!
  2. the error you see above is shown differently without the --long flag

Expected Behavior:

on the same project im running npm ls --all --json
without --long

im gettting tree + error stream:

npm ERR! missing: node-sass@^4.0.0, required by sass-loader@8.0.2
npm ERR! missing: sass@^1.3.0, required by sass-loader@8.0.2
  "error": {
    "code": "ELSPROBLEMS",
    "summary": "missing: node-sass@^4.0.0, required by sass-loader@8.0.2\r\nmissing: sass@^1.3.0, required by sass-loader@8.0.2",
    "detail": ""

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\PhilipAbed\AppData\Local\npm-cache\_logs\2021-02-18T15_01_23_184Z-debug.log

Steps To Reproduce:

install any dependency using npm install [package]
delete it manually from node_modules
run "npm ls --all --json --long"


  • OS: windows
  • Node: 1.15.7
  • npm: 7.5.1
Copy link

@nlf nlf commented Apr 9, 2021

i want to be sure i'm understanding your issue correctly, is the problem only the missing _deduped field in the json result?

i believe that if you update to the latest npm 7 release (7.9.0 as of this moment) that the error you were getting should be fixed, but i want to make sure we're not missing anything here.

Copy link

@PhilipAbed PhilipAbed commented Apr 13, 2021

yes its those 2 issues, the error and the missing deduped... i dont care about the deduped anymore i worked around that manually using paths..
so if error is fixed thank you

@darcyclarke darcyclarke added this to the OSS - Sprint 28 milestone Apr 16, 2021
@darcyclarke darcyclarke removed this from the OSS - Sprint 28 milestone Apr 19, 2021
@darcyclarke darcyclarke added this to the OSS - Sprint 29 milestone Apr 19, 2021
@ruyadorno ruyadorno self-assigned this Apr 21, 2021
ruyadorno added a commit to ruyadorno/cli that referenced this issue Apr 21, 2021
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: npm#2724
feelepxyz added a commit to dependabot/dependabot-core that referenced this issue Jul 15, 2021
* [`013f0262d`](npm/cli@013f026)
  fix(exitHandler): write code to logfile
* [`0dd0341ac`](npm/cli@0dd0341)
  fix(ping): make "npm ping" echo a right time
* [`d2e298f3c`](npm/cli@d2e298f)
  fix(deprecate): add undeprecate support


* [`9dd32d08e`](npm/cli@9dd32d0)
  fix(docs): remove npm package config override
* [`a4e095618`](npm/cli@a4e0956)
  fix(docs): remove .hooks scripts

* [`5f8ccccef`](npm/cli@5f8cccc)
  chore(tests): clean snapshot for lib/view.js tests

* [`23ce3af19`](npm/cli@23ce3af)
  feat(ls): report *why* something is invalid

* [`53f81af31`](npm/cli@53f81af)
  fix(docs): Improve phrasing of workspace example
* [`78da60ffe`](npm/cli@78da60f)
  chore(linting): add bin and clean up lib/ls.js
* [`54eae3063`](npm/cli@54eae30)
  chore(errorHandler): rename to exit handler
* [`d0f50b156`](npm/cli@d0f50b1)
  chore(refactor): async npm.load
* [`87f67d9ef`](npm/cli@87f67d9)
  chore(tests): expose real mock npm object
* [`f3dce0917`](npm/cli@f3dce09)
  chore(config): snapshot config descriptions
* [`6254b6f72`](npm/cli@6254b6f)
  @npmcli/package-json refactor

* [`fe4138381`](npm/cli@fe41383)
  * bin: allow turning off timer display with --timers=false
  * fix: do not try to inflate a fresh lockfile
  * fix(diff): walk target children if root is a link
  * chore: @npmcli/package-json refactor

* [`fce30e423`](npm/cli@fce30e4)
  fix(docs): rebuild config docs

* [`ae285b391`](npm/cli@ae285b3)
  feat(ls): support `--package-lock-only` flag
* [`c984fb59c`](npm/cli@c984fb5)
  feat(pack): add pack-destination config

* [`40829ec40`](npm/cli@40829ec)
  fix(link): do not prune packages
* [`102d4e6fb`](npm/cli@102d4e6)
  fix(workspaces): explicitly error in global mode
* [`993df3041`](npm/cli@993df30)
  fix(docs): ls command usage instructions
* [`dcc13662c`](npm/cli@dcc1366)
  fix(config): update link definition
* [`b19e56c2e`](npm/cli@b19e56c)
  fix(ls): respect prod config for workspaces
* [`c99b8b53c`](npm/cli@c99b8b5)
  fix(config): add flatOptions.npxCache
* [`e5abf2a21`](npm/cli@e5abf2a)
  chore(libnpmdiff): added as workspace
* [`c6a8734d7`](npm/cli@c6a8734)
  chore(refactor): finish passing npm context
* [`d16ee452a`](npm/cli@d16ee45)
  chore(tests): use path.resolve

* [`6b951c042`](npm/cli@6b951c0)
    * fix(retrieve-tag): pass match in a way git accepts
* [`de820a021`](npm/cli@de820a0)
  * fix: Make file: URLs (mostly) RFC 8909 compliant
* [`16a95c647`](npm/cli@16a95c6)
    * fix(inventory) handle old and british forms of 'license'
    * fix: removes [_complete] check to apply correct metadata
    * ensure node.fsParent is not set to node itself
    * fix extraneous deps on load-actual
* [`d341bd86c`](npm/cli@d341bd8)
    * fix: implement cache modes correctly
* [`c90612cf5`](npm/cli@c90612c)
    * use new npxCache option

* [`ef668ab57`](npm/cli@ef668ab)
  feat(diff): add workspace support

* [`26d00c477`](npm/cli@26d00c4)
  fix(tests): mock writeFile in pack tests so we dont create 0 byte files in the repo
* [`f130a81d6`](npm/cli@f130a81)
  fix(linting): add scripts, docs, smoke-tests
* [`992799cd8`](npm/cli@992799c)
  fix(login): properly save scope if defined

* [`844229519`](npm/cli@8442295)
  docs(workspaces): update using npm section
  Added examples of using `npm init` to bootstrap a new workspace and a
  section on how to add/manage dependencies to workspaces.

* [`3654890fb`](npm/cli@3654890)
  remove ignored dep
* [`a4a0e68a9`](npm/cli@a4a0e68)
  check less stuff into node_modules
* [`7d5b049b6`](npm/cli@7d5b049)
  chore(package) Use a "files" list

* [`e92b5f2ba`](npm/cli@e92b5f2)
    * feat: improved logging of cache status

* [`e864bd3ce`](npm/cli@e864bd3)
  fix(update-notifier): do not update notify when installing npm@spec
* [`aafe23572`](npm/cli@aafe235)
  fix(update-notifier): parallelize check for updates

* [`bc9c57dda`](npm/cli@bc9c57d)
  fix(docs): remove documentation for '--scripts-prepend-node-path' as it was removed in npm@7
* [`ca2822110`](npm/cli@ca28221)
  fix(docs): link foreground-scripts w/ loglevel
* [`fb630b5a9`](npm/cli@fb630b5)
  chore(docs): manage docs as a workspace

* [`54de5c6a4`](npm/cli@54de5c6)
    * fix: trim whitespace from fetchSpec
    * fix: handle file: when root directory begins with a special character
* [`e92b5f2ba`](npm/cli@e92b5f2)
    * breaking: complete refactor of caching. drops warning headers,
      prevents cache indexes from growing for every request, correctly
      handles varied requests to the same url, and now caches redirects.
    * fix: support url-encoded proxy authorization
    * fix: do not lazy-load proxy agents or agentkeepalive. fixes the
      intermittent failures to update npm on slower connections.
    * breaking: drop handling of deprecated warning headers
    * docs: fix header type for npm-command
    * docs: update registry param
    * feat: improved logging of cache status
* [`23c50a45f`](npm/cli@23c50a4)
    * fix: work around negotiator's lazy loading

* [`c4ef78b08`](npm/cli@c4ef78b)
  fix(automation): update incorrect variable name in create-cli-deps-pr workflow

* [`598a17a26`](npm/cli@598a17a)
  fix(libnpmexec): don't detach output from npm

* [`c4fc03e9e`](npm/cli@c4fc03e)
    * fixes reifying deps with mismatching version ranges between
      actual and virtual trees
* [`9159fa62a`](npm/cli@9159fa6)

* [`399ff8cbc`](npm/cli@399ff8c)
  feat(link): add workspace support

* [`46a9bcbcb`](npm/cli@46a9bcb)
  fix(docs): proper postinstall script file name
* [`83590d40f`](npm/cli@83590d4)
  fix(ls): show relative paths from root
* [`a574b518a`](npm/cli@a574b51)
  fix(completion): restore IFS even if `npm completion` returns error
* [`554e8a5cd`](npm/cli@554e8a5)
  set audit exit code properly
* [`4a4fbe33c`](npm/cli@4a4fbe3)
  fix(publish): skip private workspaces

* [`3c53d631f`](npm/cli@3c53d63)
  fix(docs): typo in package-lock.json docs
* [`96367f93f`](npm/cli@96367f9)
  rebuild npm-pack doc
* [`64b13dd10`](npm/cli@64b13dd)
  Drop stale Python 3<->node-gyp remark

* [`7b56bfdf3`](npm/cli@7b56bfd)
  * feat: allow fully deleting indices
  * feat: add a validateEntry option to compact
  * chore: lint
  * chore: use standard npm style release scripts
* [`dbbc151a3`](npm/cli@dbbc151)
  * fix(exit-code): account for null auditLevel default (#46)
* [`5b2604507`](npm/cli@5b26045)
  chore(package-lock): update devDependencies

* [`3d5df0082`](npm/cli@3d5df00)
  chore(ci): move node release PR workflow to cli repo

* [`0d1a9d787`](npm/cli@0d1a9d7)
  feat(install): add workspaces support to npm install commands
* [`c18626f04`](npm/cli@c18626f)
  feat(ls): add workspaces support
* [`41099d395`](npm/cli@41099d3)
  feat(explain): add workspaces support
* [`fde354669`](npm/cli@fde3546)
  feat(unpublish): add workspace/dry-run support
* [`83df3666c`](npm/cli@83df366)
  feat(outdated): add workspaces support
* [`63a7635f7`](npm/cli@63a7635)
  feat(pack): add support to json config/output

* [`faa12ccc2`](npm/cli@faa12cc)
  fix search description typos
* [`2f5c28a68`](npm/cli@2f5c28a)
  fix(docs): autogenerate config docs for commands

* [`ec256a14a`](npm/cli@ec256a1)
* [`5f15aba86`](npm/cli@5f15aba)
* [`b3add87e6`](npm/cli@b3add87)
    * fixed sso login token

* [`076420c14`](npm/cli@076420c)
  feat(publish): add workspace support
* [`370b36a36`](npm/cli@370b36a)
  feat(fund): add workspaces support

* [`0c18e4f77`](npm/cli@0c18e4f)
* [`b551c6811`](npm/cli@b551c68)

* [`de49f58f5`](npm/cli@de49f58)
  fix(contributing): link to proper cli repo
* [`1d092144e`](npm/cli@1d09214)
  fix(packages): locale-agnostic string sorting
* [`0696fca13`](npm/cli@0696fca)
  fix(view): fix non-registry specs
* [`71ac93597`](npm/cli@71ac935)
  chore(github): Convert md issue template to yaml
* [`6fb386d3b`](npm/cli@6fb386d)
  fix(tests): increase test fuzziness
* [`f3a662fcd`](npm/cli@f3a662f)
  fix(tests): use config defaults

* [`285976fd1`](npm/cli@285976f)
  * fix(reify): properly save spec if prerelease
* [`f9f24d17c`](npm/cli@f9f24d1)
  * fix(add): Specify 'en' locale to String.localeCompare
* [`cb9f17499`](npm/cli@cb9f174)
  * force 'en' locale in string sorting
* [`24b4e4a41`](npm/cli@24b4e4a)
  * Avoid locale-specific sorting issues
* [`1eb7e5c7d`](npm/cli@1eb7e5c)
  * guard against locale-specific sorting
* [`a6a826067`](npm/cli@a6a8260)
  * fix(sort): avoid locale-dependent sorting issues

* [`701627c51`](npm/cli@701627c)
  feat(cache): Allow `add` to accept multiple specs
* [`59171f030`](npm/cli@59171f0)
  feat(config): add workspaces boolean to user-agent

* [`2c9b8713c`](npm/cli@2c9b871)
  fix(docs): fix broken links
* [`88cbc8c44`](npm/cli@88cbc8c)
  fix(tests): reflect new libnpmexec logic

* [`d01ce5e13`](npm/cli@d01ce5e)
    * feat: add walk up dir lookup to satisfy local bins
* [`81c1dfaaa`](npm/cli@81c1dfa)
    * fix(add): save packages in the right place
    * fix(reify): do not clean up nodes with no parent
    * fix(audit): support alias specs & root package names
* [`87c2303ea`](npm/cli@87c2303)
    * fix(clone): Do not allow git replacement objects by default
* [`99ff40dff`](npm/cli@99ff40d)
    * feat(npmignore): Do not force include history, changelogs, notice
    * fix(package.json): add missing bin/index.js to files

* [`c371f183e`](npm/cli@c371f18)
  fix(ls): do not warn on missing optional deps
* [`861f606c7`](npm/cli@861f606)
  fix(build): make prune rule work on case-sensitive file systems

* [`fb79d89a0`](npm/cli@fb79d89)
* [`ce3820043`](npm/cli@ce38200)
    * fix: prevent and eliminate unnecessary duplicates
    * fix: support resolvable partial intersecting peerSets

* [`e479f1dac`](npm/cli@e479f1d)
  mention `directories.bin` in `bin`

* [`7925cca24`](npm/cli@7925cca)
  * fix(registry): normalize manfest
* [`b61eac693`](npm/cli@b61eac6)
* [`c74e67fc6`](npm/cli@c74e67f)

* [`efdd7dd44`](npm/cli@efdd7dd)
  Remove unused and incorrectly documented `--always-auth` config definition

* [`4c1f16d2c`](npm/cli@4c1f16d)
  feat(init): add workspaces support

* [`42ca59eee`](npm/cli@42ca59e)
  fix(ls): do not exit with error when all problems are extraneous deps
* [`2aecec591`](npm/cli@2aecec5)
  fix(ls): make --long work when missing deps
* [`42e0587a9`](npm/cli@42e0587)
  fix(pack): refuse to pack invalid packument
* [`1c4eff7b5`](npm/cli@1c4eff7)
  fix(logout): use isBasicAuth attribute

* [`c93f1c39e`](npm/cli@c93f1c3)
  chore(docs): update view docs
* [`c4ff4bc11`](npm/cli@c4ff4bc)
  fix(usage): fix refs to ws shorthand

* [`83166ebcc`](npm/cli@83166eb)
    * feat(auth): set isBasicAuth
* [`e02bda6da`](npm/cli@e02bda6)
    * feat(auth) load/send based on URI, not registry
* [`a0382deba`](npm/cli@a0382de)
    * fix: windows ComSpec env variable name
* [`7f82ef5a8`](npm/cli@7f82ef5)
* [`35e49b94f`](npm/cli@35e49b9)
* [`95faf8ce6`](npm/cli@95faf8c)
* [`17fffc0e4`](npm/cli@17fffc0)
* [`1b5a213aa`](npm/cli@1b5a213)
* [`9f83e6484`](npm/cli@9f83e64)
* [`251f788c5`](npm/cli@251f788)
* [`35873a989`](npm/cli@35873a9)
* [`23e12b4d8`](npm/cli@23e12b4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

4 participants