npm-dedupe.1 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359
  1. .TH "NPM\-DEDUPE" "1" "October 2021" "" ""
  2. .SH "NAME"
  3. \fBnpm-dedupe\fR \- Reduce duplication in the package tree
  4. .SS Synopsis
  5. .P
  6. .RS 2
  7. .nf
  8. npm dedupe
  9. npm ddp
  10. aliases: ddp
  11. .fi
  12. .RE
  13. .SS Description
  14. .P
  15. Searches the local package tree and attempts to simplify the overall
  16. structure by moving dependencies further up the tree, where they can
  17. be more effectively shared by multiple dependent packages\.
  18. .P
  19. For example, consider this dependency graph:
  20. .P
  21. .RS 2
  22. .nf
  23. a
  24. +\-\- b <\-\- depends on c@1\.0\.x
  25. | `\-\- c@1\.0\.3
  26. `\-\- d <\-\- depends on c@~1\.0\.9
  27. `\-\- c@1\.0\.10
  28. .fi
  29. .RE
  30. .P
  31. In this case, \fBnpm dedupe\fP will transform the tree to:
  32. .P
  33. .RS 2
  34. .nf
  35. a
  36. +\-\- b
  37. +\-\- d
  38. `\-\- c@1\.0\.10
  39. .fi
  40. .RE
  41. .P
  42. Because of the hierarchical nature of node's module lookup, b and d
  43. will both get their dependency met by the single c package at the root
  44. level of the tree\.
  45. .P
  46. In some cases, you may have a dependency graph like this:
  47. .P
  48. .RS 2
  49. .nf
  50. a
  51. +\-\- b <\-\- depends on c@1\.0\.x
  52. +\-\- c@1\.0\.3
  53. `\-\- d <\-\- depends on c@1\.x
  54. `\-\- c@1\.9\.9
  55. .fi
  56. .RE
  57. .P
  58. During the installation process, the \fBc@1\.0\.3\fP dependency for \fBb\fP was
  59. placed in the root of the tree\. Though \fBd\fP\|'s dependency on \fBc@1\.x\fP could
  60. have been satisfied by \fBc@1\.0\.3\fP, the newer \fBc@1\.9\.0\fP dependency was used,
  61. because npm favors updates by default, even when doing so causes
  62. duplication\.
  63. .P
  64. Running \fBnpm dedupe\fP will cause npm to note the duplication and
  65. re\-evaluate, deleting the nested \fBc\fP module, because the one in the root is
  66. sufficient\.
  67. .P
  68. To prefer deduplication over novelty during the installation process, run
  69. \fBnpm install \-\-prefer\-dedupe\fP or \fBnpm config set prefer\-dedupe true\fP\|\.
  70. .P
  71. Arguments are ignored\. Dedupe always acts on the entire tree\.
  72. .P
  73. Note that this operation transforms the dependency tree, but will never
  74. result in new modules being installed\.
  75. .P
  76. Using \fBnpm find\-dupes\fP will run the command in \fB\-\-dry\-run\fP mode\.
  77. .SS Configuration
  78. <!\-\- AUTOGENERATED CONFIG DESCRIPTIONS START \-\->
  79. <!\-\- automatically generated, do not edit manually \-\->
  80. <!\-\- see lib/utils/config/definitions\.js \-\->
  81. .SS \fBglobal\-style\fP
  82. .RS 0
  83. .IP \(bu 2
  84. Default: false
  85. .IP \(bu 2
  86. Type: Boolean
  87. .RE
  88. .P
  89. Causes npm to install the package into your local \fBnode_modules\fP folder with
  90. the same layout it uses with the global \fBnode_modules\fP folder\. Only your
  91. direct dependencies will show in \fBnode_modules\fP and everything they depend
  92. on will be flattened in their \fBnode_modules\fP folders\. This obviously will
  93. eliminate some deduping\. If used with \fBlegacy\-bundling\fP, \fBlegacy\-bundling\fP
  94. will be preferred\.
  95. <!\-\- automatically generated, do not edit manually \-\->
  96. <!\-\- see lib/utils/config/definitions\.js \-\->
  97. .SS \fBlegacy\-bundling\fP
  98. .RS 0
  99. .IP \(bu 2
  100. Default: false
  101. .IP \(bu 2
  102. Type: Boolean
  103. .RE
  104. .P
  105. Causes npm to install the package such that versions of npm prior to 1\.4,
  106. such as the one included with node 0\.8, can install the package\. This
  107. eliminates all automatic deduping\. If used with \fBglobal\-style\fP this option
  108. will be preferred\.
  109. <!\-\- automatically generated, do not edit manually \-\->
  110. <!\-\- see lib/utils/config/definitions\.js \-\->
  111. .SS \fBstrict\-peer\-deps\fP
  112. .RS 0
  113. .IP \(bu 2
  114. Default: false
  115. .IP \(bu 2
  116. Type: Boolean
  117. .RE
  118. .P
  119. If set to \fBtrue\fP, and \fB\-\-legacy\-peer\-deps\fP is not set, then \fIany\fR
  120. conflicting \fBpeerDependencies\fP will be treated as an install failure, even
  121. if npm could reasonably guess the appropriate resolution based on non\-peer
  122. dependency relationships\.
  123. .P
  124. By default, conflicting \fBpeerDependencies\fP deep in the dependency graph will
  125. be resolved using the nearest non\-peer dependency specification, even if
  126. doing so will result in some packages receiving a peer dependency outside
  127. the range set in their package's \fBpeerDependencies\fP object\.
  128. .P
  129. When such and override is performed, a warning is printed, explaining the
  130. conflict and the packages involved\. If \fB\-\-strict\-peer\-deps\fP is set, then
  131. this warning is treated as a failure\.
  132. <!\-\- automatically generated, do not edit manually \-\->
  133. <!\-\- see lib/utils/config/definitions\.js \-\->
  134. .SS \fBpackage\-lock\fP
  135. .RS 0
  136. .IP \(bu 2
  137. Default: true
  138. .IP \(bu 2
  139. Type: Boolean
  140. .RE
  141. .P
  142. If set to false, then ignore \fBpackage\-lock\.json\fP files when installing\. This
  143. will also prevent \fIwriting\fR \fBpackage\-lock\.json\fP if \fBsave\fP is true\.
  144. .P
  145. When package package\-locks are disabled, automatic pruning of extraneous
  146. modules will also be disabled\. To remove extraneous modules with
  147. package\-locks disabled use \fBnpm prune\fP\|\.
  148. <!\-\- automatically generated, do not edit manually \-\->
  149. <!\-\- see lib/utils/config/definitions\.js \-\->
  150. .SS \fBomit\fP
  151. .RS 0
  152. .IP \(bu 2
  153. Default: 'dev' if the \fBNODE_ENV\fP environment variable is set to
  154. \|'production', otherwise empty\.
  155. .IP \(bu 2
  156. Type: "dev", "optional", or "peer" (can be set multiple times)
  157. .RE
  158. .P
  159. Dependency types to omit from the installation tree on disk\.
  160. .P
  161. Note that these dependencies \fIare\fR still resolved and added to the
  162. \fBpackage\-lock\.json\fP or \fBnpm\-shrinkwrap\.json\fP file\. They are just not
  163. physically installed on disk\.
  164. .P
  165. If a package type appears in both the \fB\-\-include\fP and \fB\-\-omit\fP lists, then
  166. it will be included\.
  167. .P
  168. If the resulting omit list includes \fB\|'dev'\fP, then the \fBNODE_ENV\fP environment
  169. variable will be set to \fB\|'production'\fP for all lifecycle scripts\.
  170. <!\-\- automatically generated, do not edit manually \-\->
  171. <!\-\- see lib/utils/config/definitions\.js \-\->
  172. .SS \fBignore\-scripts\fP
  173. .RS 0
  174. .IP \(bu 2
  175. Default: false
  176. .IP \(bu 2
  177. Type: Boolean
  178. .RE
  179. .P
  180. If true, npm does not run scripts specified in package\.json files\.
  181. .P
  182. Note that commands explicitly intended to run a particular script, such as
  183. \fBnpm start\fP, \fBnpm stop\fP, \fBnpm restart\fP, \fBnpm test\fP, and \fBnpm run\-script\fP
  184. will still run their intended script if \fBignore\-scripts\fP is set, but they
  185. will \fInot\fR run any pre\- or post\-scripts\.
  186. <!\-\- automatically generated, do not edit manually \-\->
  187. <!\-\- see lib/utils/config/definitions\.js \-\->
  188. .SS \fBaudit\fP
  189. .RS 0
  190. .IP \(bu 2
  191. Default: true
  192. .IP \(bu 2
  193. Type: Boolean
  194. .RE
  195. .P
  196. When "true" submit audit reports alongside the current npm command to the
  197. default registry and all registries configured for scopes\. See the
  198. documentation for npm help \fBaudit\fP for details on what is
  199. submitted\.
  200. <!\-\- automatically generated, do not edit manually \-\->
  201. <!\-\- see lib/utils/config/definitions\.js \-\->
  202. .SS \fBbin\-links\fP
  203. .RS 0
  204. .IP \(bu 2
  205. Default: true
  206. .IP \(bu 2
  207. Type: Boolean
  208. .RE
  209. .P
  210. Tells npm to create symlinks (or \fB\|\.cmd\fP shims on Windows) for package
  211. executables\.
  212. .P
  213. Set to false to have it not do this\. This can be used to work around the
  214. fact that some file systems don't support symlinks, even on ostensibly Unix
  215. systems\.
  216. <!\-\- automatically generated, do not edit manually \-\->
  217. <!\-\- see lib/utils/config/definitions\.js \-\->
  218. .SS \fBfund\fP
  219. .RS 0
  220. .IP \(bu 2
  221. Default: true
  222. .IP \(bu 2
  223. Type: Boolean
  224. .RE
  225. .P
  226. When "true" displays the message at the end of each \fBnpm install\fP
  227. acknowledging the number of dependencies looking for funding\. See npm help \fBnpm
  228. fund\fP for details\.
  229. <!\-\- automatically generated, do not edit manually \-\->
  230. <!\-\- see lib/utils/config/definitions\.js \-\->
  231. .SS \fBdry\-run\fP
  232. .RS 0
  233. .IP \(bu 2
  234. Default: false
  235. .IP \(bu 2
  236. Type: Boolean
  237. .RE
  238. .P
  239. Indicates that you don't want npm to make any changes and that it should
  240. only report what it would have done\. This can be passed into any of the
  241. commands that modify your local installation, eg, \fBinstall\fP, \fBupdate\fP,
  242. \fBdedupe\fP, \fBuninstall\fP, as well as \fBpack\fP and \fBpublish\fP\|\.
  243. .P
  244. Note: This is NOT honored by other network related commands, eg \fBdist\-tags\fP,
  245. \fBowner\fP, etc\.
  246. <!\-\- automatically generated, do not edit manually \-\->
  247. <!\-\- see lib/utils/config/definitions\.js \-\->
  248. .SS \fBworkspace\fP
  249. .RS 0
  250. .IP \(bu 2
  251. Default:
  252. .IP \(bu 2
  253. Type: String (can be set multiple times)
  254. .RE
  255. .P
  256. Enable running a command in the context of the configured workspaces of the
  257. current project while filtering by running only the workspaces defined by
  258. this configuration option\.
  259. .P
  260. Valid values for the \fBworkspace\fP config are either:
  261. .RS 0
  262. .IP \(bu 2
  263. Workspace names
  264. .IP \(bu 2
  265. Path to a workspace directory
  266. .IP \(bu 2
  267. Path to a parent workspace directory (will result in selecting all
  268. workspaces within that folder)
  269. .RE
  270. .P
  271. When set for the \fBnpm init\fP command, this may be set to the folder of a
  272. workspace which does not yet exist, to create the folder and set it up as a
  273. brand new workspace within the project\.
  274. .P
  275. This value is not exported to the environment for child processes\.
  276. <!\-\- automatically generated, do not edit manually \-\->
  277. <!\-\- see lib/utils/config/definitions\.js \-\->
  278. .SS \fBworkspaces\fP
  279. .RS 0
  280. .IP \(bu 2
  281. Default: null
  282. .IP \(bu 2
  283. Type: null or Boolean
  284. .RE
  285. .P
  286. Set to true to run the command in the context of \fBall\fR configured
  287. workspaces\.
  288. .P
  289. Explicitly setting this to false will cause commands like \fBinstall\fP to
  290. ignore workspaces altogether\. When not set explicitly:
  291. .RS 0
  292. .IP \(bu 2
  293. Commands that operate on the \fBnode_modules\fP tree (install, update, etc\.)
  294. will link workspaces into the \fBnode_modules\fP folder\. \- Commands that do
  295. other things (test, exec, publish, etc\.) will operate on the root project,
  296. \fIunless\fR one or more workspaces are specified in the \fBworkspace\fP config\.
  297. .RE
  298. .P
  299. This value is not exported to the environment for child processes\.
  300. <!\-\- automatically generated, do not edit manually \-\->
  301. <!\-\- see lib/utils/config/definitions\.js \-\->
  302. .SS \fBinclude\-workspace\-root\fP
  303. .RS 0
  304. .IP \(bu 2
  305. Default: false
  306. .IP \(bu 2
  307. Type: Boolean
  308. .RE
  309. .P
  310. Include the workspace root when workspaces are enabled for a command\.
  311. .P
  312. When false, specifying individual workspaces via the \fBworkspace\fP config, or
  313. all workspaces via the \fBworkspaces\fP flag, will cause npm to operate only on
  314. the specified workspaces, and not on the root project\.
  315. <!\-\- automatically generated, do not edit manually \-\->
  316. <!\-\- see lib/utils/config/definitions\.js \-\->
  317. <!\-\- AUTOGENERATED CONFIG DESCRIPTIONS END \-\->
  318. .SS See Also
  319. .RS 0
  320. .IP \(bu 2
  321. npm help find\-dupes
  322. .IP \(bu 2
  323. npm help ls
  324. .IP \(bu 2
  325. npm help update
  326. .IP \(bu 2
  327. npm help install
  328. .RE