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