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