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