.TH "NPM\-LS" "1" "November 2023" "9.2.0" .SH "NAME" \fBnpm-ls\fR .SH Synopsis .SH Description .P This command will print to stdout all the versions of packages that are .br installed, as well as their dependencies when \fB\-\-all\fP is specified, in a .br tree structure\. .P Note: to get a "bottoms up" view of why a given package is included in the .br tree at all, use \fBnpm explain\fP\|\. .P Positional arguments are \fBname@version\-range\fP identifiers, which will limit .br the results to only the paths to the packages named\. Note that nested .br packages will \fIalso\fR show the paths to the specified packages\. For .br example, running \fBnpm ls promzard\fP in npm's source tree will show: .RS 2 .nf npm@@VERSION@ /path/to/npm └─┬ init\-package\-json@0\.0\.4 └── promzard@0\.1\.5 .fi .RE .P It will print out extraneous, missing, and invalid packages\. .P If a project specifies git urls for dependencies these are shown .br in parentheses after the \fBname@version\fP to make it easier for users to .br recognize potential forks of a project\. .P The tree shown is the logical dependency tree, based on package .br dependencies, not the physical layout of your \fBnode_modules\fP folder\. .P When run as \fBll\fP or \fBla\fP, it shows extended information by default\. .SH Note: Design Changes Pending .P The \fBnpm ls\fP command's output and behavior made a \fIton\fR of sense when npm .br created a \fBnode_modules\fP folder that naively nested every dependency\. In .br such a case, the logical dependency graph and physical tree of packages on .br disk would be roughly identical\. .P With the advent of automatic install\-time deduplication of dependencies in .br npm v3, the \fBls\fP output was modified to display the logical dependency .br graph as a tree structure, since this was more useful to most users\. .br However, without using \fBnpm ls \-l\fP, it became impossible to show \fIwhere\fR a .br package was actually installed much of the time! .P With the advent of automatic installation of \fBpeerDependencies\fP in npm v7, .br this gets even more curious, as \fBpeerDependencies\fP are logically .br "underneath" their dependents in the dependency graph, but are always .br physically at or above their location on disk\. .P Also, in the years since npm got an \fBls\fP command (in version 0\.0\.2!), .br dependency graphs have gotten much larger as a general rule\. Therefore, in .br order to avoid dumping an excessive amount of content to the terminal, \fBnpm ls\fP now only shows the \fItop\fR level dependencies, unless \fB\-\-all\fP is .br provided\. .P A thorough re\-examination of the use cases, intention, behavior, and output .br of this command, is currently underway\. Expect significant changes to at .br least the default human\-readable \fBnpm ls\fP output in npm v8\. .SH Configuration .SH See Also .RS 1 .IP \(bu 2 package spec .IP \(bu 2 npm explain .IP \(bu 2 npm config .IP \(bu 2 npmrc .IP \(bu 2 npm folders .IP \(bu 2 npm explain .IP \(bu 2 npm install .IP \(bu 2 npm link .IP \(bu 2 npm prune .IP \(bu 2 npm outdated .IP \(bu 2 npm update .RE