1NPM-ROOT(1) NPM-ROOT(1)
2
3
4
6 npm-root - Display npm root
7
8 Synopsis
9 npm root
10
11 Note: This command is unaware of workspaces.
12
13 Description
14 Print the effective node_modules folder to standard out.
15
16 Useful for using npm in shell scripts that do things with the node_mod‐
17 ules folder. For example:
18
19 #!/bin/bash
20 global_node_modules="$(npm root --global)"
21 echo "Global packages installed in: ${global_node_modules}"
22
23 Configuration
24 global
25 • Default: false
26
27 • Type: Boolean
28
29
30 Operates in "global" mode, so that packages are installed into the pre‐
31 fix folder instead of the current working directory. See npm help fold‐
32 ers for more on the differences in behavior.
33
34 • packages are installed into the {prefix}/lib/node_modules folder,
35 instead of the current working directory.
36
37 • bin files are linked to {prefix}/bin
38
39 • man pages are linked to {prefix}/share/man
40
41
42 See Also
43 • npm help prefix
44
45 • npm help folders
46
47 • npm help config
48
49 • npm help npmrc
50
51
52
53 November 2023 NPM-ROOT(1)