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