1 ---
2 title: npm-ls
3 section: 1
4 description: List installed packages
5 github_repo: npm/cli
6 github_branch: latest
7 github_path: docs/lib/content/commands/npm-ls.md
8 redirect_from:
9 - /cli-commands/ls
10 - /cli-commands/npm-ls
11 - /cli-documentation/cli-commands/ls
12 - /cli-documentation/cli-commands/npm-ls
13 - /cli-documentation/commands/ls
14 - /cli-documentation/commands/npm-ls
15 - /cli-documentation/ls
16 - /cli-documentation/npm-ls
17 - /cli-documentation/v11/cli-commands/ls
18 - /cli-documentation/v11/cli-commands/npm-ls
19 - /cli-documentation/v11/commands/ls
20 - /cli-documentation/v11/commands/npm-ls
21 - /cli-documentation/v11/ls
22 - /cli-documentation/v11/npm-ls
23 - /cli/cli-commands/ls
24 - /cli/cli-commands/npm-ls
25 - /cli/commands/ls
26 - /cli/commands/npm-ls
27 - /cli/ls
28 - /cli/npm-ls
29 - /cli/v11/cli-commands/ls
30 - /cli/v11/cli-commands/npm-ls
31 - /cli/v11/commands/ls
32 - /cli/v11/ls
33 - /cli/v11/npm-ls
34 - /commands/ls
35 - /commands/npm-ls
36 ---
37
38 ### Synopsis
39
40 ```bash
41 npm ls <package-spec>
42
43 alias: list
44 ```
45
46 ### Description
47
48 This command will print to stdout all the versions of packages that are installed, as well as their dependencies when `--all` is specified, in a tree structure.
49
50 Note: to get a "bottoms up" view of why a given package is included in the tree at all, use [`npm explain`](/cli/v11/commands/npm-explain).
51
52 Positional arguments are `name@version-range` identifiers, which will limit the results to only the paths to the packages named. Note that nested packages will _also_ show the paths to the specified packages. For example, running `npm ls promzard` in npm's source tree will show:
53
54 ```bash
55 npm@11.11.1 /path/to/npm
56 └─┬ init-package-json@0.0.4
57 └── promzard@0.1.5
58 ```
59
60 It will print out extraneous, missing, and invalid packages.
61
62 If a project specifies git urls for dependencies these are shown in parentheses after the `name@version` to make it easier for users to recognize potential forks of a project.
63
64 The tree shown is the logical dependency tree, based on package dependencies, not the physical layout of your `node_modules` folder.
65
66 When run as `ll` or `la`, it shows extended information by default.
67
68 ### Configuration
69
70 #### `all`
71
72 - Default: false
73 - Type: Boolean
74
75 When running `npm outdated` and `npm ls`, setting `--all` will show all outdated or installed packages, rather than only those directly depended upon by the current project.
76
77 #### `json`
78
79 - Default: false
80 - Type: Boolean
81
82 Whether or not to output JSON data, rather than the normal output.
83
84 - In `npm pkg set` it enables parsing set values with JSON.parse() before saving them to your `package.json`.
85
86 Not supported by all npm commands.
87
88 #### `long`
89
90 - Default: false
91 - Type: Boolean
92
93 Show extended information in `ls`, `search`, and `help-search`.
94
95 #### `parseable`
96
97 - Default: false
98 - Type: Boolean
99
100 Output parseable results from commands that write to standard output. For `npm search`, this will be tab-separated table format.
101
102 #### `global`
103
104 - Default: false
105 - Type: Boolean
106
107 Operates in "global" mode, so that packages are installed into the `prefix` folder instead of the current working directory. See [folders](/cli/v11/configuring-npm/folders) for more on the differences in behavior.
108
109 - packages are installed into the `{prefix}/lib/node_modules` folder, instead of the current working directory.
110 - bin files are linked to `{prefix}/bin`
111 - man pages are linked to `{prefix}/share/man`
112
113 #### `depth`
114
115 - Default: `Infinity` if `--all` is set; otherwise, `0`
116 - Type: null or Number
117
118 The depth to go when recursing packages for `npm ls`.
119
120 If not set, `npm ls` will show only the immediate dependencies of the root project. If `--all` is set, then npm will show all dependencies by default.
121
122 #### `omit`
123
124 - Default: 'dev' if the `NODE_ENV` environment variable is set to 'production'; otherwise, empty.
125 - Type: "dev", "optional", or "peer" (can be set multiple times)
126
127 Dependency types to omit from the installation tree on disk.
128
129 Note that these dependencies _are_ still resolved and added to the `package-lock.json` or `npm-shrinkwrap.json` file. They are just not physically installed on disk.
130
131 If a package type appears in both the `--include` and `--omit` lists, then it will be included.
132
133 If the resulting omit list includes `'dev'`, then the `NODE_ENV` environment variable will be set to `'production'` for all lifecycle scripts.
134
135 #### `include`
136
137 - Default:
138 - Type: "prod", "dev", "optional", or "peer" (can be set multiple times)
139
140 Option that allows for defining which types of dependencies to install.
141
142 This is the inverse of `--omit=<type>`.
143
144 Dependency types specified in `--include` will not be omitted, regardless of the order in which omit/include are specified on the command-line.
145
146 #### `link`
147
148 - Default: false
149 - Type: Boolean
150
151 Used with `npm ls`, limiting output to only those packages that are linked.
152
153 #### `package-lock-only`
154
155 - Default: false
156 - Type: Boolean
157
158 If set to true, the current operation will only use the `package-lock.json`, ignoring `node_modules`.
159
160 For `update` this means only the `package-lock.json` will be updated, instead of checking `node_modules` and downloading dependencies.
161
162 For `list` this means the output will be based on the tree described by the `package-lock.json`, rather than the contents of `node_modules`.
163
164 #### `unicode`
165
166 - Default: false on windows, true on mac/unix systems with a unicode locale, as defined by the `LC_ALL`, `LC_CTYPE`, or `LANG` environment variables.
167 - Type: Boolean
168
169 When set to true, npm uses unicode characters in the tree output. When false, it uses ascii characters instead of unicode glyphs.
170
171 #### `workspace`
172
173 - Default:
174 - Type: String (can be set multiple times)
175
176 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.
177
178 Valid values for the `workspace` config are either:
179
180 - Workspace names
181 - Path to a workspace directory
182 - Path to a parent workspace directory (will result in selecting all workspaces within that folder)
183
184 When set for the `npm init` 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.
185
186 This value is not exported to the environment for child processes.
187
188 #### `workspaces`
189
190 - Default: null
191 - Type: null or Boolean
192
193 Set to true to run the command in the context of **all** configured workspaces.
194
195 Explicitly setting this to false will cause commands like `install` to ignore workspaces altogether. When not set explicitly:
196
197 - Commands that operate on the `node_modules` tree (install, update, etc.) will link workspaces into the `node_modules` folder. - Commands that do other things (test, exec, publish, etc.) will operate on the root project, _unless_ one or more workspaces are specified in the `workspace` config.
198
199 This value is not exported to the environment for child processes.
200
201 #### `include-workspace-root`
202
203 - Default: false
204 - Type: Boolean
205
206 Include the workspace root when workspaces are enabled for a command.
207
208 When false, specifying individual workspaces via the `workspace` config, or all workspaces via the `workspaces` flag, will cause npm to operate only on the specified workspaces, and not on the root project.
209
210 This value is not exported to the environment for child processes.
211
212 #### `install-links`
213
214 - Default: false
215 - Type: Boolean
216
217 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.
218
219 ### See Also
220
221 - [package spec](/cli/v11/using-npm/package-spec)
222 - [npm explain](/cli/v11/commands/npm-explain)
223 - [npm config](/cli/v11/commands/npm-config)
224 - [npmrc](/cli/v11/configuring-npm/npmrc)
225 - [npm folders](/cli/v11/configuring-npm/folders)
226 - [npm explain](/cli/v11/commands/npm-explain)
227 - [npm install](/cli/v11/commands/npm-install)
228 - [npm link](/cli/v11/commands/npm-link)
229 - [npm prune](/cli/v11/commands/npm-prune)
230 - [npm outdated](/cli/v11/commands/npm-outdated)
231 - [npm update](/cli/v11/commands/npm-update)