1 ---
2 title: npm-prefix
3 section: 1
4 description: Display prefix
5 github_repo: npm/cli
6 github_branch: latest
7 github_path: docs/lib/content/commands/npm-prefix.md
8 redirect_from:
9 - /cli-commands/npm-prefix
10 - /cli-commands/prefix
11 - /cli-documentation/cli-commands/npm-prefix
12 - /cli-documentation/cli-commands/prefix
13 - /cli-documentation/commands/npm-prefix
14 - /cli-documentation/commands/prefix
15 - /cli-documentation/npm-prefix
16 - /cli-documentation/prefix
17 - /cli-documentation/v10/cli-commands/npm-prefix
18 - /cli-documentation/v10/cli-commands/prefix
19 - /cli-documentation/v10/commands/npm-prefix
20 - /cli-documentation/v10/commands/prefix
21 - /cli-documentation/v10/npm-prefix
22 - /cli-documentation/v10/prefix
23 - /cli/cli-commands/npm-prefix
24 - /cli/cli-commands/prefix
25 - /cli/commands/npm-prefix
26 - /cli/commands/prefix
27 - /cli/npm-prefix
28 - /cli/prefix
29 - /cli/v10/cli-commands/npm-prefix
30 - /cli/v10/cli-commands/prefix
31 - /cli/v10/commands/prefix
32 - /cli/v10/npm-prefix
33 - /cli/v10/prefix
34 - /commands/npm-prefix
35 - /commands/prefix
36 ---
37
38 ### Synopsis
39
40 ```bash
41 npm prefix [-g]
42 ```
43
44 Note: This command is unaware of workspaces.
45
46 ### Description
47
48 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.
49
50 If `-g` is specified, this will be the value of the global prefix. See [`npm config`](/cli/v10/commands/npm-config) for more detail.
51
52 ### Example
53
54 ```bash
55 npm prefix
56 /usr/local/projects/foo
57 ```
58
59 ```bash
60 npm prefix -g
61 /usr/local
62 ```
63
64 ### Configuration
65
66 #### `global`
67
68 - Default: false
69 - Type: Boolean
70
71 Operates in "global" mode, so that packages are installed into the `prefix` folder instead of the current working directory. See [folders](/cli/v10/configuring-npm/folders) for more on the differences in behavior.
72
73 - packages are installed into the `{prefix}/lib/node_modules` folder, instead of the current working directory.
74 - bin files are linked to `{prefix}/bin`
75 - man pages are linked to `{prefix}/share/man`
76
77 ### See Also
78
79 - [npm root](/cli/v10/commands/npm-root)
80 - [npm folders](/cli/v10/configuring-npm/folders)
81 - [npm config](/cli/v10/commands/npm-config)
82 - [npmrc](/cli/v10/configuring-npm/npmrc)