2025-04-10 14:36:22 -07:00
.TH "NPM-LS" "1" "April 2025" "NPM@11.3.0" ""
2011-11-26 09:21:03 -08:00
.SH "NAME"
2022-12-06 22:18:33 -05:00
\fB npm-ls\fR - List installed packages
.SS "Synopsis"
2014-09-24 14:41:07 -07:00
.P
.RS 2
2014-11-04 15:08:12 -08:00
.nf
2022-12-06 22:18:33 -05:00
npm ls <package-spec>
2015-10-09 23:13:57 -07:00
2022-02-24 21:41:49 +00:00
alias: list
2014-11-04 15:08:12 -08:00
.fi
2014-09-24 14:41:07 -07:00
.RE
2022-12-06 22:18:33 -05:00
.SS "Description"
2014-09-24 14:41:07 -07:00
.P
2022-12-06 22:18:33 -05:00
This command will print to stdout all the versions of packages that are installed, as well as their dependencies when \fB --all\fR is specified, in a tree structure.
2011-11-26 09:21:03 -08:00
.P
2022-12-06 22:18:33 -05:00
Note: to get a "bottoms up" view of why a given package is included in the tree at all, use npm help explain.
2020-12-11 18:54:56 -05:00
.P
2022-12-06 22:18:33 -05:00
Positional arguments are \fB name@version-range\fR identifiers, which will limit the results to only the paths to the packages named. Note that nested packages will \fI also\fR show the paths to the specified packages. For example, running \fB npm ls promzard\fR in npm's source tree will show:
2014-09-24 14:41:07 -07:00
.P
.RS 2
2014-11-04 15:08:12 -08:00
.nf
2025-04-10 14:36:22 -07:00
npm@11.3.0 /path/to/npm
2022-12-06 22:18:33 -05:00
└─┬ init-package-json@0.0.4
└── promzard@0.1.5
2014-11-04 15:08:12 -08:00
.fi
2014-09-24 14:41:07 -07:00
.RE
2011-11-26 09:21:03 -08:00
.P
2022-12-06 22:18:33 -05:00
It will print out extraneous, missing, and invalid packages.
.P
If a project specifies git urls for dependencies these are shown in parentheses after the \fB name@version\fR to make it easier for users to recognize potential forks of a project.
.P
The tree shown is the logical dependency tree, based on package dependencies, not the physical layout of your \fB node_modules\fR folder.
.P
When run as \fB ll\fR or \fB la\fR , it shows extended information by default.
.SS "Configuration"
.SS "\fBall\fR"
2020-12-11 18:54:56 -05:00
.RS 0
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2021-05-20 15:54:50 -04:00
Default: false
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2020-12-11 18:54:56 -05:00
Type: Boolean
2022-12-06 22:18:33 -05:00
.RE 0
2020-12-11 18:54:56 -05:00
.P
2022-12-06 22:18:33 -05:00
When running \fB npm outdated\fR and \fB npm ls\fR , setting \fB --all\fR will show all outdated or installed packages, rather than only those directly depended upon by the current project.
.SS "\fBjson\fR"
2014-09-24 14:41:07 -07:00
.RS 0
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2012-09-10 09:11:54 -07:00
Default: false
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2012-09-10 09:11:54 -07:00
Type: Boolean
2022-12-06 22:18:33 -05:00
.RE 0
2014-09-24 14:41:07 -07:00
2012-09-10 09:11:54 -07:00
.P
2022-12-06 22:18:33 -05:00
Whether or not to output JSON data, rather than the normal output.
2021-07-15 20:09:18 +00:00
.RS 0
2022-12-06 22:18:33 -05:00
.IP \(bu 4
In \fB npm pkg set\fR it enables parsing set values with JSON.parse() before saving them to your \fB package.json\fR .
.RE 0
2021-07-15 20:09:18 +00:00
2021-05-20 15:54:50 -04:00
.P
2022-12-06 22:18:33 -05:00
Not supported by all npm commands.
.SS "\fBlong\fR"
2014-09-24 14:41:07 -07:00
.RS 0
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2011-11-26 09:21:03 -08:00
Default: false
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2011-11-26 09:21:03 -08:00
Type: Boolean
2022-12-06 22:18:33 -05:00
.RE 0
2014-09-24 14:41:07 -07:00
2011-11-26 09:21:03 -08:00
.P
2022-12-06 22:18:33 -05:00
Show extended information in \fB ls\fR , \fB search\fR , and \fB help-search\fR .
.SS "\fBparseable\fR"
2014-09-24 14:41:07 -07:00
.RS 0
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2011-11-26 09:21:03 -08:00
Default: false
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2011-11-26 09:21:03 -08:00
Type: Boolean
2022-12-06 22:18:33 -05:00
.RE 0
2014-09-24 14:41:07 -07:00
2011-11-26 09:21:03 -08:00
.P
2022-12-06 22:18:33 -05:00
Output parseable results from commands that write to standard output. For \fB npm search\fR , this will be tab-separated table format.
.SS "\fBglobal\fR"
2014-09-24 14:41:07 -07:00
.RS 0
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2011-11-26 09:21:03 -08:00
Default: false
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2011-11-26 09:21:03 -08:00
Type: Boolean
2022-12-06 22:18:33 -05:00
.RE 0
2014-09-24 14:41:07 -07:00
2011-11-26 09:21:03 -08:00
.P
2022-12-06 22:18:33 -05:00
Operates in "global" mode, so that packages are installed into the \fB prefix\fR folder instead of the current working directory. See npm help folders for more on the differences in behavior.
2014-09-24 14:41:07 -07:00
.RS 0
2022-12-06 22:18:33 -05:00
.IP \(bu 4
packages are installed into the \fB {prefix}/lib/node_modules\fR folder, instead of the current working directory.
.IP \(bu 4
bin files are linked to \fB {prefix}/bin\fR
.IP \(bu 4
man pages are linked to \fB {prefix}/share/man\fR
.RE 0
2021-05-20 15:54:50 -04:00
2022-12-06 22:18:33 -05:00
.SS "\fBdepth\fR"
2021-05-20 15:54:50 -04:00
.RS 0
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2025-02-02 07:09:59 -08:00
Default: \fB Infinity\fR if \fB --all\fR is set, otherwise \fB 0\fR
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2021-05-20 15:54:50 -04:00
Type: null or Number
2022-12-06 22:18:33 -05:00
.RE 0
2014-09-24 14:41:07 -07:00
2014-02-12 18:16:32 -08:00
.P
2022-12-06 22:18:33 -05:00
The depth to go when recursing packages for \fB npm ls\fR .
2021-05-20 15:54:50 -04:00
.P
2022-12-06 22:18:33 -05:00
If not set, \fB npm ls\fR will show only the immediate dependencies of the root project. If \fB --all\fR is set, then npm will show all dependencies by default.
.SS "\fBomit\fR"
2015-03-06 02:57:32 -06:00
.RS 0
2022-12-06 22:18:33 -05:00
.IP \(bu 4
Default: 'dev' if the \fB NODE_ENV\fR environment variable is set to 'production', otherwise empty.
.IP \(bu 4
2021-05-20 15:54:50 -04:00
Type: "dev", "optional", or "peer" (can be set multiple times)
2022-12-06 22:18:33 -05:00
.RE 0
2015-03-06 02:57:32 -06:00
.P
2022-12-06 22:18:33 -05:00
Dependency types to omit from the installation tree on disk.
2021-05-20 15:54:50 -04:00
.P
2022-12-06 22:18:33 -05:00
Note that these dependencies \fI are\fR still resolved and added to the \fB package-lock.json\fR or \fB npm-shrinkwrap.json\fR file. They are just not physically installed on disk.
2021-05-20 15:54:50 -04:00
.P
2022-12-06 22:18:33 -05:00
If a package type appears in both the \fB --include\fR and \fB --omit\fR lists, then it will be included.
2021-05-20 15:54:50 -04:00
.P
2022-12-06 22:18:33 -05:00
If the resulting omit list includes \fB 'dev'\fR , then the \fB NODE_ENV\fR environment variable will be set to \fB 'production'\fR for all lifecycle scripts.
2023-10-13 06:55:37 -07:00
.SS "\fBinclude\fR"
.RS 0
.IP \(bu 4
Default:
.IP \(bu 4
Type: "prod", "dev", "optional", or "peer" (can be set multiple times)
.RE 0
.P
Option that allows for defining which types of dependencies to install.
.P
This is the inverse of \fB --omit=<type>\fR .
.P
Dependency types specified in \fB --include\fR will not be omitted, regardless of the order in which omit/include are specified on the command-line.
2022-12-06 22:18:33 -05:00
.SS "\fBlink\fR"
2015-03-06 02:57:32 -06:00
.RS 0
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2021-05-20 15:54:50 -04:00
Default: false
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2015-03-06 02:57:32 -06:00
Type: Boolean
2022-12-06 22:18:33 -05:00
.RE 0
2021-05-20 15:54:50 -04:00
.P
2022-12-06 22:18:33 -05:00
Used with \fB npm ls\fR , limiting output to only those packages that are linked.
.SS "\fBpackage-lock-only\fR"
2021-05-20 15:54:50 -04:00
.RS 0
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2021-06-17 18:59:38 +00:00
Default: false
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2021-06-17 18:59:38 +00:00
Type: Boolean
2022-12-06 22:18:33 -05:00
.RE 0
2021-05-20 15:54:50 -04:00
.P
2022-12-06 22:18:33 -05:00
If set to true, the current operation will only use the \fB package-lock.json\fR , ignoring \fB node_modules\fR .
2021-06-17 18:59:38 +00:00
.P
2022-12-06 22:18:33 -05:00
For \fB update\fR this means only the \fB package-lock.json\fR will be updated, instead of checking \fB node_modules\fR and downloading dependencies.
2021-06-17 18:59:38 +00:00
.P
2022-12-06 22:18:33 -05:00
For \fB list\fR this means the output will be based on the tree described by the \fB package-lock.json\fR , rather than the contents of \fB node_modules\fR .
.SS "\fBunicode\fR"
2021-05-20 15:54:50 -04:00
.RS 0
2022-12-06 22:18:33 -05:00
.IP \(bu 4
Default: false on windows, true on mac/unix systems with a unicode locale, as defined by the \fB LC_ALL\fR , \fB LC_CTYPE\fR , or \fB LANG\fR environment variables.
.IP \(bu 4
2021-05-20 15:54:50 -04:00
Type: Boolean
2022-12-06 22:18:33 -05:00
.RE 0
2015-03-06 02:57:32 -06:00
.P
2022-12-06 22:18:33 -05:00
When set to true, npm uses unicode characters in the tree output. When false, it uses ascii characters instead of unicode glyphs.
.SS "\fBworkspace\fR"
2015-10-09 23:13:57 -07:00
.RS 0
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2021-05-20 15:54:50 -04:00
Default:
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2021-05-20 15:54:50 -04:00
Type: String (can be set multiple times)
2022-12-06 22:18:33 -05:00
.RE 0
2015-10-09 23:13:57 -07:00
.P
2022-12-06 22:18:33 -05:00
Enable running a command in the context of the configured workspaces of the current project while filtering by running only the workspaces defined by this configuration option.
2015-10-09 23:13:57 -07:00
.P
2022-12-06 22:18:33 -05:00
Valid values for the \fB workspace\fR config are either:
2017-07-14 10:52:48 -07:00
.RS 0
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2021-05-20 15:54:50 -04:00
Workspace names
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2021-05-20 15:54:50 -04:00
Path to a workspace directory
2022-12-06 22:18:33 -05:00
.IP \(bu 4
Path to a parent workspace directory (will result in selecting all workspaces within that folder)
.RE 0
2017-07-14 10:52:48 -07:00
.P
2022-12-06 22:18:33 -05:00
When set for the \fB npm init\fR command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a brand new workspace within the project.
2021-05-20 15:54:50 -04:00
.P
2022-12-06 22:18:33 -05:00
This value is not exported to the environment for child processes.
.SS "\fBworkspaces\fR"
2014-09-24 14:41:07 -07:00
.RS 0
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2021-10-14 22:17:47 +00:00
Default: null
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2021-10-14 22:17:47 +00:00
Type: null or Boolean
2022-12-06 22:18:33 -05:00
.RE 0
2019-11-05 14:55:08 -05:00
.P
2022-12-06 22:18:33 -05:00
Set to true to run the command in the context of \fB all\fR configured workspaces.
2021-05-20 15:54:50 -04:00
.P
2022-12-06 22:18:33 -05:00
Explicitly setting this to false will cause commands like \fB install\fR to ignore workspaces altogether. When not set explicitly:
2021-10-14 22:17:47 +00:00
.RS 0
2022-12-06 22:18:33 -05:00
.IP \(bu 4
Commands that operate on the \fB node_modules\fR tree (install, update, etc.) will link workspaces into the \fB node_modules\fR folder. - Commands that do other things (test, exec, publish, etc.) will operate on the root project, \fI unless\fR one or more workspaces are specified in the \fB workspace\fR config.
.RE 0
2021-10-14 22:17:47 +00:00
.P
2022-12-06 22:18:33 -05:00
This value is not exported to the environment for child processes.
.SS "\fBinclude-workspace-root\fR"
2021-10-14 22:17:47 +00:00
.RS 0
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2021-10-14 22:17:47 +00:00
Default: false
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2021-10-14 22:17:47 +00:00
Type: Boolean
2022-12-06 22:18:33 -05:00
.RE 0
2021-10-14 22:17:47 +00:00
.P
2022-12-06 22:18:33 -05:00
Include the workspace root when workspaces are enabled for a command.
2021-10-14 22:17:47 +00:00
.P
2022-12-06 22:18:33 -05:00
When false, specifying individual workspaces via the \fB workspace\fR config, or all workspaces via the \fB workspaces\fR flag, will cause npm to operate only on the specified workspaces, and not on the root project.
2022-04-14 21:57:02 +00:00
.P
2022-12-06 22:18:33 -05:00
This value is not exported to the environment for child processes.
.SS "\fBinstall-links\fR"
2022-04-28 18:41:15 +05:30
.RS 0
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2023-02-18 17:09:39 -05:00
Default: false
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2022-04-28 18:41:15 +05:30
Type: Boolean
2022-12-06 22:18:33 -05:00
.RE 0
2022-04-28 18:41:15 +05:30
.P
2022-12-06 22:18:33 -05:00
When set file: protocol dependencies will be packed and installed as regular dependencies instead of creating a symlink. This option has no effect on workspaces.
.SS "See Also"
2019-11-05 14:55:08 -05:00
.RS 0
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2022-11-07 13:02:05 -05:00
npm help "package spec"
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2020-12-11 18:54:56 -05:00
npm help explain
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2019-11-18 21:01:39 +02:00
npm help config
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2019-11-05 14:55:08 -05:00
npm help npmrc
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2019-11-05 14:55:08 -05:00
npm help folders
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2020-10-02 17:52:19 -04:00
npm help explain
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2019-11-18 21:01:39 +02:00
npm help install
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2019-11-18 21:01:39 +02:00
npm help link
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2019-11-18 21:01:39 +02:00
npm help prune
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2019-11-18 21:01:39 +02:00
npm help outdated
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2019-11-18 21:01:39 +02:00
npm help update
2022-12-06 22:18:33 -05:00
.RE 0