1NPM-DEDUPE(1) NPM-DEDUPE(1)
2
3
4
6 npm-dedupe - Reduce duplication
7
8 Synopsis
9 npm dedupe
10 npm ddp
11
12 aliases: find-dupes, ddp
13
14 Description
15 Searches the local package tree and attempts to simplify the overall
16 structure by moving dependencies further up the tree, where they can be
17 more effectively shared by multiple dependent packages.
18
19 For example, consider this dependency graph:
20
21 a
22 +-- b <-- depends on c@1.0.x
23 | `-- c@1.0.3
24 `-- d <-- depends on c@~1.0.9
25 `-- c@1.0.10
26
27 In this case, npm dedupe will transform the tree to:
28
29 a
30 +-- b
31 +-- d
32 `-- c@1.0.10
33
34 Because of the hierarchical nature of node's module lookup, b and d
35 will both get their dependency met by the single c package at the root
36 level of the tree.
37
38 The deduplication algorithm walks the tree, moving each dependency as
39 far up in the tree as possible, even if duplicates are not found. This
40 will result in both a flat and deduplicated tree.
41
42 If a suitable version exists at the target location in the tree
43 already, then it will be left untouched, but the other duplicates will
44 be deleted.
45
46 Arguments are ignored. Dedupe always acts on the entire tree.
47
48 Modules
49
50 Note that this operation transforms the dependency tree, but will never
51 result in new modules being installed.
52
53 See Also
54 · npm help ls
55
56 · npm help update
57
58 · npm help install
59
60
61
62
63 February 2021 NPM-DEDUPE(1)