1---
2title: npm-prefix
3section: 1
4description: Display prefix
5---
6
7### Synopsis
8
9```bash
10npm prefix [-g]
11```
12
13Note: This command is unaware of workspaces.
14
15### Description
16
17Print the local prefix to standard output. This is the closest parent directory
18to contain a `package.json` file or `node_modules` directory, unless `-g` is
19also specified.
20
21If `-g` is specified, this will be the value of the global prefix. See
22[`npm config`](/commands/npm-config) for more detail.
23
24### Example
25
26```bash
27npm prefix
28/usr/local/projects/foo
29```
30
31```bash
32npm prefix -g
33/usr/local
34```
35
36### Configuration
37
38#### `global`
39
40* Default: false
41* Type: Boolean
42
43Operates in "global" mode, so that packages are installed into the `prefix`
44folder instead of the current working directory. See
45[folders](/configuring-npm/folders) for more on the differences in behavior.
46
47* packages are installed into the `{prefix}/lib/node_modules` folder, instead
48  of the current working directory.
49* bin files are linked to `{prefix}/bin`
50* man pages are linked to `{prefix}/share/man`
51
52
53
54### See Also
55
56* [npm root](/commands/npm-root)
57* [npm folders](/configuring-npm/folders)
58* [npm config](/commands/npm-config)
59* [npmrc](/configuring-npm/npmrc)
60