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