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