1 ---
2 title: npm-root
3 section: 1
4 description: Display npm root
5 github_repo: npm/cli
6 github_branch: release/v8
7 github_path: docs/lib/content/commands/npm-root.md
8 redirect_from:
9 - /cli-documentation/v8/cli-commands/npm-root
10 - /cli-documentation/v8/cli-commands/root
11 - /cli-documentation/v8/commands/npm-root
12 - /cli-documentation/v8/commands/root
13 - /cli-documentation/v8/npm-root
14 - /cli-documentation/v8/root
15 - /cli/v8/cli-commands/npm-root
16 - /cli/v8/cli-commands/root
17 - /cli/v8/commands/root
18 - /cli/v8/npm-root
19 - /cli/v8/root
20 ---
21
22 ### Synopsis
23
24 ```bash
25 npm root
26 ```
27
28 ### Description
29
30 Print the effective `node_modules` folder to standard out.
31
32 Useful for using npm in shell scripts that do things with the `node_modules` folder. For example:
33
34 ```bash
35 #!/bin/bash
36 global_node_modules="$(npm root --global)"
37 echo "Global packages installed in: ${global_node_modules}"
38 ```
39
40 ### Configuration
41
42 #### `global`
43
44 - Default: false
45 - Type: Boolean
46
47 Operates in "global" mode, so that packages are installed into the `prefix` folder instead of the current working directory. See [folders](/cli/v8/configuring-npm/folders) for more on the differences in behavior.
48
49 - packages are installed into the `{prefix}/lib/node_modules` folder, instead of the current working directory.
50 - bin files are linked to `{prefix}/bin`
51 - man pages are linked to `{prefix}/share/man`
52
53 ### See Also
54
55 - [npm prefix](/cli/v8/commands/npm-prefix)
56 - [npm bin](/cli/v8/commands/npm-bin)
57 - [npm folders](/cli/v8/configuring-npm/folders)
58 - [npm config](/cli/v8/commands/npm-config)
59 - [npmrc](/cli/v8/configuring-npm/npmrc)