npm ls --json

Category: Node.js & npm/yarn

npm ls --json

List installed packages as JSON

Prints the dependency tree of the project as machine-readable JSON, including extraneous or missing packages flagged as errors. Handy for scripting or feeding into jq. The tree can be huge, so filter with npm ls --depth=0 or npm ls <package>.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.