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