Team Ai
Datasetpublic

codekingpro/portable-devtools

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