npm-ls.1 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  1. .TH "NPM\-LS" "1" "October 2021" "" ""
  2. .SH "NAME"
  3. \fBnpm-ls\fR \- List installed packages
  4. .SS Synopsis
  5. .P
  6. .RS 2
  7. .nf
  8. npm ls [[<@scope>/]<pkg> \.\.\.]
  9. aliases: list, la, ll
  10. .fi
  11. .RE
  12. .SS Description
  13. .P
  14. This command will print to stdout all the versions of packages that are
  15. installed, as well as their dependencies when \fB\-\-all\fP is specified, in a
  16. tree structure\.
  17. .P
  18. Note: to get a "bottoms up" view of why a given package is included in the
  19. tree at all, use npm help \fBexplain\fP\|\.
  20. .P
  21. Positional arguments are \fBname@version\-range\fP identifiers, which will limit
  22. the results to only the paths to the packages named\. Note that nested
  23. packages will \fIalso\fR show the paths to the specified packages\. For
  24. example, running \fBnpm ls promzard\fP in npm's source tree will show:
  25. .P
  26. .RS 2
  27. .nf
  28. npm@8\.1\.2 /path/to/npm
  29. └─┬ init\-package\-json@0\.0\.4
  30. └── promzard@0\.1\.5
  31. .fi
  32. .RE
  33. .P
  34. It will print out extraneous, missing, and invalid packages\.
  35. .P
  36. If a project specifies git urls for dependencies these are shown
  37. in parentheses after the name@version to make it easier for users to
  38. recognize potential forks of a project\.
  39. .P
  40. The tree shown is the logical dependency tree, based on package
  41. dependencies, not the physical layout of your \fBnode_modules\fP folder\.
  42. .P
  43. When run as \fBll\fP or \fBla\fP, it shows extended information by default\.
  44. .SS Note: Design Changes Pending
  45. .P
  46. The \fBnpm ls\fP command's output and behavior made a \fIton\fR of sense when npm
  47. created a \fBnode_modules\fP folder that naively nested every dependency\. In
  48. such a case, the logical dependency graph and physical tree of packages on
  49. disk would be roughly identical\.
  50. .P
  51. With the advent of automatic install\-time deduplication of dependencies in
  52. npm v3, the \fBls\fP output was modified to display the logical dependency
  53. graph as a tree structure, since this was more useful to most users\.
  54. However, without using \fBnpm ls \-l\fP, it became impossible show \fIwhere\fR a
  55. package was actually installed much of the time!
  56. .P
  57. With the advent of automatic installation of \fBpeerDependencies\fP in npm v7,
  58. this gets even more curious, as \fBpeerDependencies\fP are logically
  59. "underneath" their dependents in the dependency graph, but are always
  60. physically at or above their location on disk\.
  61. .P
  62. Also, in the years since npm got an \fBls\fP command (in version 0\.0\.2!),
  63. dependency graphs have gotten much larger as a general rule\. Therefore, in
  64. order to avoid dumping an excessive amount of content to the terminal, \fBnpm
  65. ls\fP now only shows the \fItop\fR level dependencies, unless \fB\-\-all\fP is
  66. provided\.
  67. .P
  68. A thorough re\-examination of the use cases, intention, behavior, and output
  69. of this command, is currently underway\. Expect significant changes to at
  70. least the default human\-readable \fBnpm ls\fP output in npm v8\.
  71. .SS Configuration
  72. <!\-\- AUTOGENERATED CONFIG DESCRIPTIONS START \-\->
  73. <!\-\- automatically generated, do not edit manually \-\->
  74. <!\-\- see lib/utils/config/definitions\.js \-\->
  75. .SS \fBall\fP
  76. .RS 0
  77. .IP \(bu 2
  78. Default: false
  79. .IP \(bu 2
  80. Type: Boolean
  81. .RE
  82. .P
  83. When running \fBnpm outdated\fP and \fBnpm ls\fP, setting \fB\-\-all\fP will show all
  84. outdated or installed packages, rather than only those directly depended
  85. upon by the current project\.
  86. <!\-\- automatically generated, do not edit manually \-\->
  87. <!\-\- see lib/utils/config/definitions\.js \-\->
  88. .SS \fBjson\fP
  89. .RS 0
  90. .IP \(bu 2
  91. Default: false
  92. .IP \(bu 2
  93. Type: Boolean
  94. .RE
  95. .P
  96. Whether or not to output JSON data, rather than the normal output\.
  97. .RS 0
  98. .IP \(bu 2
  99. In \fBnpm pkg set\fP it enables parsing set values with JSON\.parse() before
  100. saving them to your \fBpackage\.json\fP\|\.
  101. .RE
  102. .P
  103. Not supported by all npm commands\.
  104. <!\-\- automatically generated, do not edit manually \-\->
  105. <!\-\- see lib/utils/config/definitions\.js \-\->
  106. .SS \fBlong\fP
  107. .RS 0
  108. .IP \(bu 2
  109. Default: false
  110. .IP \(bu 2
  111. Type: Boolean
  112. .RE
  113. .P
  114. Show extended information in \fBls\fP, \fBsearch\fP, and \fBhelp\-search\fP\|\.
  115. <!\-\- automatically generated, do not edit manually \-\->
  116. <!\-\- see lib/utils/config/definitions\.js \-\->
  117. .SS \fBparseable\fP
  118. .RS 0
  119. .IP \(bu 2
  120. Default: false
  121. .IP \(bu 2
  122. Type: Boolean
  123. .RE
  124. .P
  125. Output parseable results from commands that write to standard output\. For
  126. \fBnpm search\fP, this will be tab\-separated table format\.
  127. <!\-\- automatically generated, do not edit manually \-\->
  128. <!\-\- see lib/utils/config/definitions\.js \-\->
  129. .SS \fBglobal\fP
  130. .RS 0
  131. .IP \(bu 2
  132. Default: false
  133. .IP \(bu 2
  134. Type: Boolean
  135. .RE
  136. .P
  137. Operates in "global" mode, so that packages are installed into the \fBprefix\fP
  138. folder instead of the current working directory\. See
  139. npm help folders for more on the differences in behavior\.
  140. .RS 0
  141. .IP \(bu 2
  142. packages are installed into the \fB{prefix}/lib/node_modules\fP folder, instead
  143. of the current working directory\.
  144. .IP \(bu 2
  145. bin files are linked to \fB{prefix}/bin\fP
  146. .IP \(bu 2
  147. man pages are linked to \fB{prefix}/share/man\fP
  148. .RE
  149. <!\-\- automatically generated, do not edit manually \-\->
  150. <!\-\- see lib/utils/config/definitions\.js \-\->
  151. .SS \fBdepth\fP
  152. .RS 0
  153. .IP \(bu 2
  154. Default: \fBInfinity\fP if \fB\-\-all\fP is set, otherwise \fB1\fP
  155. .IP \(bu 2
  156. Type: null or Number
  157. .RE
  158. .P
  159. The depth to go when recursing packages for \fBnpm ls\fP\|\.
  160. .P
  161. If not set, \fBnpm ls\fP will show only the immediate dependencies of the root
  162. project\. If \fB\-\-all\fP is set, then npm will show all dependencies by default\.
  163. <!\-\- automatically generated, do not edit manually \-\->
  164. <!\-\- see lib/utils/config/definitions\.js \-\->
  165. .SS \fBomit\fP
  166. .RS 0
  167. .IP \(bu 2
  168. Default: 'dev' if the \fBNODE_ENV\fP environment variable is set to
  169. \|'production', otherwise empty\.
  170. .IP \(bu 2
  171. Type: "dev", "optional", or "peer" (can be set multiple times)
  172. .RE
  173. .P
  174. Dependency types to omit from the installation tree on disk\.
  175. .P
  176. Note that these dependencies \fIare\fR still resolved and added to the
  177. \fBpackage\-lock\.json\fP or \fBnpm\-shrinkwrap\.json\fP file\. They are just not
  178. physically installed on disk\.
  179. .P
  180. If a package type appears in both the \fB\-\-include\fP and \fB\-\-omit\fP lists, then
  181. it will be included\.
  182. .P
  183. If the resulting omit list includes \fB\|'dev'\fP, then the \fBNODE_ENV\fP environment
  184. variable will be set to \fB\|'production'\fP for all lifecycle scripts\.
  185. <!\-\- automatically generated, do not edit manually \-\->
  186. <!\-\- see lib/utils/config/definitions\.js \-\->
  187. .SS \fBlink\fP
  188. .RS 0
  189. .IP \(bu 2
  190. Default: false
  191. .IP \(bu 2
  192. Type: Boolean
  193. .RE
  194. .P
  195. Used with \fBnpm ls\fP, limiting output to only those packages that are linked\.
  196. <!\-\- automatically generated, do not edit manually \-\->
  197. <!\-\- see lib/utils/config/definitions\.js \-\->
  198. .SS \fBpackage\-lock\-only\fP
  199. .RS 0
  200. .IP \(bu 2
  201. Default: false
  202. .IP \(bu 2
  203. Type: Boolean
  204. .RE
  205. .P
  206. If set to true, the current operation will only use the \fBpackage\-lock\.json\fP,
  207. ignoring \fBnode_modules\fP\|\.
  208. .P
  209. For \fBupdate\fP this means only the \fBpackage\-lock\.json\fP will be updated,
  210. instead of checking \fBnode_modules\fP and downloading dependencies\.
  211. .P
  212. For \fBlist\fP this means the output will be based on the tree described by the
  213. \fBpackage\-lock\.json\fP, rather than the contents of \fBnode_modules\fP\|\.
  214. <!\-\- automatically generated, do not edit manually \-\->
  215. <!\-\- see lib/utils/config/definitions\.js \-\->
  216. .SS \fBunicode\fP
  217. .RS 0
  218. .IP \(bu 2
  219. Default: false on windows, true on mac/unix systems with a unicode locale,
  220. as defined by the \fBLC_ALL\fP, \fBLC_CTYPE\fP, or \fBLANG\fP environment variables\.
  221. .IP \(bu 2
  222. Type: Boolean
  223. .RE
  224. .P
  225. When set to true, npm uses unicode characters in the tree output\. When
  226. false, it uses ascii characters instead of unicode glyphs\.
  227. <!\-\- automatically generated, do not edit manually \-\->
  228. <!\-\- see lib/utils/config/definitions\.js \-\->
  229. .SS \fBworkspace\fP
  230. .RS 0
  231. .IP \(bu 2
  232. Default:
  233. .IP \(bu 2
  234. Type: String (can be set multiple times)
  235. .RE
  236. .P
  237. Enable running a command in the context of the configured workspaces of the
  238. current project while filtering by running only the workspaces defined by
  239. this configuration option\.
  240. .P
  241. Valid values for the \fBworkspace\fP config are either:
  242. .RS 0
  243. .IP \(bu 2
  244. Workspace names
  245. .IP \(bu 2
  246. Path to a workspace directory
  247. .IP \(bu 2
  248. Path to a parent workspace directory (will result in selecting all
  249. workspaces within that folder)
  250. .RE
  251. .P
  252. When set for the \fBnpm init\fP command, this may be set to the folder of a
  253. workspace which does not yet exist, to create the folder and set it up as a
  254. brand new workspace within the project\.
  255. .P
  256. This value is not exported to the environment for child processes\.
  257. <!\-\- automatically generated, do not edit manually \-\->
  258. <!\-\- see lib/utils/config/definitions\.js \-\->
  259. .SS \fBworkspaces\fP
  260. .RS 0
  261. .IP \(bu 2
  262. Default: null
  263. .IP \(bu 2
  264. Type: null or Boolean
  265. .RE
  266. .P
  267. Set to true to run the command in the context of \fBall\fR configured
  268. workspaces\.
  269. .P
  270. Explicitly setting this to false will cause commands like \fBinstall\fP to
  271. ignore workspaces altogether\. When not set explicitly:
  272. .RS 0
  273. .IP \(bu 2
  274. Commands that operate on the \fBnode_modules\fP tree (install, update, etc\.)
  275. will link workspaces into the \fBnode_modules\fP folder\. \- Commands that do
  276. other things (test, exec, publish, etc\.) will operate on the root project,
  277. \fIunless\fR one or more workspaces are specified in the \fBworkspace\fP config\.
  278. .RE
  279. .P
  280. This value is not exported to the environment for child processes\.
  281. <!\-\- automatically generated, do not edit manually \-\->
  282. <!\-\- see lib/utils/config/definitions\.js \-\->
  283. .SS \fBinclude\-workspace\-root\fP
  284. .RS 0
  285. .IP \(bu 2
  286. Default: false
  287. .IP \(bu 2
  288. Type: Boolean
  289. .RE
  290. .P
  291. Include the workspace root when workspaces are enabled for a command\.
  292. .P
  293. When false, specifying individual workspaces via the \fBworkspace\fP config, or
  294. all workspaces via the \fBworkspaces\fP flag, will cause npm to operate only on
  295. the specified workspaces, and not on the root project\.
  296. <!\-\- automatically generated, do not edit manually \-\->
  297. <!\-\- see lib/utils/config/definitions\.js \-\->
  298. <!\-\- AUTOGENERATED CONFIG DESCRIPTIONS END \-\->
  299. .SS See Also
  300. .RS 0
  301. .IP \(bu 2
  302. npm help explain
  303. .IP \(bu 2
  304. npm help config
  305. .IP \(bu 2
  306. npm help npmrc
  307. .IP \(bu 2
  308. npm help folders
  309. .IP \(bu 2
  310. npm help explain
  311. .IP \(bu 2
  312. npm help install
  313. .IP \(bu 2
  314. npm help link
  315. .IP \(bu 2
  316. npm help prune
  317. .IP \(bu 2
  318. npm help outdated
  319. .IP \(bu 2
  320. npm help update
  321. .RE