npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

CLI: ls command should provide better information

If I run this command:

npm ls --json

I get output that looks like this for each installed package:

"cli": {
      "version": "1.0.1",
      "from": "cli@1.0.1",
      "resolved": "",
      "dependencies": {...}

Two critical pieces of information are missing:

1. The path to the installed package on disk.
2. Is this package a dependency, devDependency, or optionalDependency?

If I run npm ls --parseable I can get a list of all installed packages by local file path, but that does not show me the dependency relationships between packages.

Likewise, if I run npm ls --json --only=[dev|prod] I can get a list of only production and/or development dependencies.

Why can’t all this information simply be included in the JSON output? I shouldn’t have to run three or four separate commands to get all the information I need.