Skip to content

license-ls does not work with npm@7 and hangs forever #20

@sch0rsch

Description

@sch0rsch

license-ls does not work with npm@7 and hangs forever

Using [email protected] with npm 7.19.0 does not work: it produces no output and does not terminate.

How to reproduce?

Simply run license-ls with npm@latest

Details

7.19.0

...\license-ls> set DEBUG=license-ls
...\license-ls> node cli.js --depth=0 --prod > NUL
- Analyzing  license-ls Got these options: [
  "--depth=0",
  "--prod=true",
  "--production=true",
  "--include=id,name,version,license,repository,author,homepage,dependencyLevel",
  "--csv=[object Object]",
  "--table=[object Object]",
  "--xml=[object Object]"
] +0ms
- Analyzing  license-ls The `node ls` command exited with the following code: 0 +619ms
  license-ls Total paths found: 1 +0ms
  license-ls Dependency paths: [ '7.19.0' ] +0ms
(node:16820) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, lstat '...\license-ls\7.19.0'
(Use `node --trace-warnings ...` to show where the warning was created)
(node:16820) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To term
inate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:16820) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
/ Analyzing

The spinner before Analyzing keeps spinning forever and you have to termine license-ls manually.

Error causes

The cuplrit seems to be that npm 7 changed the argument handling drastically:

...\license-ls> npm -v
6.14.13

...\license-ls> npm list --parseable --prod --depth=0 "--csv=[object Object]"
...\license-ls
...\license-ls\node_modules\cross-spawn
...\license-ls\node_modules\debug
...\license-ls\node_modules\glob
...\license-ls\node_modules\json2csv
...\license-ls\node_modules\jstoxml
...\license-ls\node_modules\lodash
...\license-ls\node_modules\ora
...\license-ls\node_modules\read-package-tree
...\license-ls\node_modules\spdx-expression-parse
...\license-ls\node_modules\spdx-license-list
...\license-ls\node_modules\table
...\license-ls\node_modules\yargs

...\license-ls>
...\license-ls>npm -v
7.19.0

...\license-ls>npm list --parseable --prod --depth=0 "--csv=[object Object]"
7.19.0

...\license-ls>

When license-ls is started with [email protected] npmList(...) returns ['7.19.0'] as package list.
This in turn leads to a Error: ENOENT which is not handled and the spinner keeps spinning.

(The hang only occurs in an interactive TTY as ora does not animate the spinners when
license-ls is started by other means)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions