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

NAME

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