1 ---
2 title: npm-prefix
3 section: 1
4 description: Display prefix
5 github_repo: npm/cli
6 github_branch: release/v6
7 github_path: docs/content/commands/npm-prefix.md
8 redirect_from:
9 - /cli-documentation/v6/cli-commands/npm-prefix
10 - /cli-documentation/v6/cli-commands/prefix
11 - /cli-documentation/v6/commands/npm-prefix
12 - /cli-documentation/v6/commands/prefix
13 - /cli-documentation/v6/npm-prefix
14 - /cli-documentation/v6/prefix
15 - /cli/v6/cli-commands/npm-prefix
16 - /cli/v6/cli-commands/prefix
17 - /cli/v6/commands/prefix
18 - /cli/v6/npm-prefix
19 - /cli/v6/prefix
20 ---
21
22 ### Synopsis
23
24 ```bash
25 npm prefix [-g]
26 ```
27
28 ### Description
29
30 Print the local prefix to standard out. This is the closest parent directory to contain a `package.json` file or `node_modules` directory, unless `-g` is also specified.
31
32 If `-g` is specified, this will be the value of the global prefix. See [`npm config`](/cli/v6/commands/npm-config) for more detail.
33
34 ### See Also
35
36 - [npm root](/cli/v6/commands/npm-root)
37 - [npm bin](/cli/v6/commands/npm-bin)
38 - [npm folders](/cli/v6/configuring-npm/folders)
39 - [npm config](/cli/v6/commands/npm-config)
40 - [npmrc](/cli/v6/configuring-npm/npmrc)