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