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 <!-- AUTOGENERATED CONFIG DESCRIPTIONS START --> <!-- automatically
30 generated, do not edit manually --> <!-- see lib/utils/config/defini‐
31 tions.js -->
32
33 global
34 • Default: false
35
36 • Type: Boolean
37
38
39 Operates in "global" mode, so that packages are installed into the pre‐
40 fix folder instead of the current working directory. See npm help fold‐
41 ers for more on the differences in behavior.
42
43 • packages are installed into the {prefix}/lib/node_modules folder, in‐
44 stead of the current working directory.
45
46 • bin files are linked to {prefix}/bin
47
48 • man pages are linked to {prefix}/share/man
49
50 <!-- automatically generated, do not edit manually --> <!-- see
51 lib/utils/config/definitions.js -->
52
53 <!-- AUTOGENERATED CONFIG DESCRIPTIONS END -->
54
55
56 See Also
57 • npm help root
58
59 • npm help bin
60
61 • npm help folders
62
63 • npm help config
64
65 • npm help npmrc
66
67
68
69
70 January 2022 NPM-PREFIX(1)