1NPM-CONFIG(1) NPM-CONFIG(1)
2
3
4
6 npm-config - Manage the npm configuration files
7
8 Synopsis
9 npm config set <key>=<value> [<key>=<value> ...]
10 npm config get [<key> [<key> ...]]
11 npm config delete <key> [<key> ...]
12 npm config list [--json]
13 npm config edit
14 npm config fix
15
16 alias: c
17
18 Note: This command is unaware of workspaces.
19
20 Description
21 npm gets its config settings from the command line, environment vari‐
22 ables, npmrc files, and in some cases, the package.json file.
23
24 See npm help npmrc for more information about the npmrc files.
25
26 See npm help config for a more thorough explanation of the mechanisms
27 involved, and a full list of config options available.
28
29 The npm config command can be used to update and edit the contents of
30 the user and global npmrc files.
31
32 Sub-commands
33 Config supports the following sub-commands:
34
35 set
36 npm config set key=value [key=value...]
37 npm set key=value [key=value...]
38
39 Sets each of the config keys to the value provided.
40
41 If value is omitted, the key will be removed from your config file en‐
42 tirely.
43
44 Note: for backwards compatibility, npm config set key value is sup‐
45 ported as an alias for npm config set key=value.
46
47 get
48 npm config get [key ...]
49 npm get [key ...]
50
51 Echo the config value(s) to stdout.
52
53 If multiple keys are provided, then the values will be prefixed with
54 the key names.
55
56 If no keys are provided, then this command behaves the same as npm con‐
57 fig list.
58
59 list
60 npm config list
61
62 Show all the config settings. Use -l to also show defaults. Use --json
63 to show the settings in json format.
64
65 delete
66 npm config delete key [key ...]
67
68 Deletes the specified keys from all configuration files.
69
70 edit
71 npm config edit
72
73 Opens the config file in an editor. Use the --global flag to edit the
74 global config.
75
76 fix
77 npm config fix
78
79 Attempts to repair invalid configuration items. Usually this means at‐
80 taching authentication config (i.e. _auth, _authToken) to the config‐
81 ured registry.
82
83 Configuration
84 json
85 • Default: false
86
87 • Type: Boolean
88
89
90 Whether or not to output JSON data, rather than the normal output.
91
92 • In npm pkg set it enables parsing set values with JSON.parse() be‐
93 fore saving them to your package.json.
94
95
96 Not supported by all npm commands.
97
98 global
99 • Default: false
100
101 • Type: Boolean
102
103
104 Operates in "global" mode, so that packages are installed into the pre‐
105 fix folder instead of the current working directory. See npm help fold‐
106 ers for more on the differences in behavior.
107
108 • packages are installed into the {prefix}/lib/node_modules folder,
109 instead of the current working directory.
110
111 • bin files are linked to {prefix}/bin
112
113 • man pages are linked to {prefix}/share/man
114
115
116 editor
117 • Default: The EDITOR or VISUAL environment variables, or '%SYSTEM‐
118 ROOT%\notepad.exe' on Windows, or 'vi' on Unix systems
119
120 • Type: String
121
122
123 The command to run for npm edit and npm config edit.
124
125 location
126 • Default: "user" unless --global is passed, which will also set this
127 value to "global"
128
129 • Type: "global", "user", or "project"
130
131
132 When passed to npm config this refers to which config file to use.
133
134 When set to "global" mode, packages are installed into the prefix
135 folder instead of the current working directory. See npm help folders
136 for more on the differences in behavior.
137
138 • packages are installed into the {prefix}/lib/node_modules folder,
139 instead of the current working directory.
140
141 • bin files are linked to {prefix}/bin
142
143 • man pages are linked to {prefix}/share/man
144
145
146 long
147 • Default: false
148
149 • Type: Boolean
150
151
152 Show extended information in ls, search, and help-search.
153
154 See Also
155 • npm help folders
156
157 • npm help config
158
159 • package.json ⟨/configuring-npm/package-json⟩
160
161 • npm help npmrc
162
163 • npm help npm
164
165
166
167 November 2023 NPM-CONFIG(1)