1NPM-ROOT(1) NPM-ROOT(1)
2
3
4
6 npm-root - Display npm root
7
8 Synopsis
9 npm root [-g]
10
11 Description
12 Print the effective node_modules folder to standard out.
13
14 Useful for using npm in shell scripts that do things with the node_mod‐
15 ules folder. For example:
16
17 #!/bin/bash
18 global_node_modules="$(npm root --global)"
19 echo "Global packages installed in: ${global_node_modules}"
20
21 Configuration
22 <!-- AUTOGENERATED CONFIG DESCRIPTIONS START --> <!-- automatically
23 generated, do not edit manually --> <!-- see lib/utils/config/defini‐
24 tions.js -->
25
26 global
27 • Default: false
28
29 • Type: Boolean
30
31
32 Operates in "global" mode, so that packages are installed into the pre‐
33 fix folder instead of the current working directory. See npm help fold‐
34 ers for more on the differences in behavior.
35
36 • packages are installed into the {prefix}/lib/node_modules folder, in‐
37 stead of the current working directory.
38
39 • bin files are linked to {prefix}/bin
40
41 • man pages are linked to {prefix}/share/man
42
43 <!-- automatically generated, do not edit manually --> <!-- see
44 lib/utils/config/definitions.js -->
45
46 <!-- AUTOGENERATED CONFIG DESCRIPTIONS END -->
47
48
49 See Also
50 • npm help prefix
51
52 • npm help bin
53
54 • npm help folders
55
56 • npm help config
57
58 • npm help npmrc
59
60
61
62
63 January 2022 NPM-ROOT(1)