1NPM-EXPLAIN(1)                                                  NPM-EXPLAIN(1)
2
3
4

NAME

6       npm-explain - Explain installed packages
7
8   Synopsis
9         npm explain <package-spec>
10
11         alias: why
12
13   Description
14       This command will print the chain of dependencies causing a given pack‐
15       age to be installed in the current project.
16
17       If one or more package specs are provided, then only packages  matching
18       one of the specifiers will have their relationships explained.
19
20       The package spec can also refer to a folder within ./node_modules
21
22       For  example,  running  npm  explain glob within npm's source tree will
23       show:
24
25         glob@7.1.6
26         node_modules/glob
27           glob@"^7.1.4" from the root project
28
29         glob@7.1.1 dev
30         node_modules/tacks/node_modules/glob
31           glob@"^7.0.5" from rimraf@2.6.2
32           node_modules/tacks/node_modules/rimraf
33             rimraf@"^2.6.2" from tacks@1.3.0
34             node_modules/tacks
35               dev tacks@"^1.3.0" from the root project
36
37       To explain just the package residing at a specific folder, pass that as
38       the  argument to the command.  This can be useful when trying to figure
39       out exactly why a given dependency is being duplicated to satisfy  con‐
40       flicting version requirements within the project.
41
42         $ npm explain node_modules/nyc/node_modules/find-up
43         find-up@3.0.0 dev
44         node_modules/nyc/node_modules/find-up
45           find-up@"^3.0.0" from nyc@14.1.1
46           node_modules/nyc
47             nyc@"^14.1.1" from tap@14.10.8
48             node_modules/tap
49               dev tap@"^14.10.8" from the root project
50
51   Configuration
52   json
53       • Default: false
54
55       • Type: Boolean
56
57
58       Whether or not to output JSON data, rather than the normal output.
59
60       • In npm pkg set it enables parsing set values with JSON.parse() before
61         saving them to your package.json.
62
63
64       Not supported by all npm commands.
65
66   workspace
67       • Default:
68
69       • Type: String (can be set multiple times)
70
71
72       Enable running a command in the context of the configured workspaces of
73       the  current project while filtering by running only the workspaces de‐
74       fined by this configuration option.
75
76       Valid values for the workspace config are either:
77
78       • Workspace names
79
80       • Path to a workspace directory
81
82       • Path to a parent workspace directory (will result  in  selecting  all
83         workspaces within that folder)
84
85
86       When  set  for the npm init command, this may be set to the folder of a
87       workspace which does not yet exist, to create the folder and set it  up
88       as a brand new workspace within the project.
89
90       This value is not exported to the environment for child processes.
91
92   See Also
93       • npm help package spec
94
95       • npm help config
96
97       • npm help npmrc
98
99       • npm help folders
100
101       • npm help ls
102
103       • npm help install
104
105       • npm help link
106
107       • npm help prune
108
109       • npm help outdated
110
111       • npm help update
112
113
114
115
116                                September 2022                  NPM-EXPLAIN(1)
Impressum