npm-ls.1 7.8 KB

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