11cb0ef41Sopenharmony_ci---
21cb0ef41Sopenharmony_cititle: npm-config
31cb0ef41Sopenharmony_cisection: 1
41cb0ef41Sopenharmony_cidescription: Manage the npm configuration files
51cb0ef41Sopenharmony_ci---
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_ci### Synopsis
81cb0ef41Sopenharmony_ci
91cb0ef41Sopenharmony_ci```bash
101cb0ef41Sopenharmony_cinpm config set <key>=<value> [<key>=<value> ...]
111cb0ef41Sopenharmony_cinpm config get [<key> [<key> ...]]
121cb0ef41Sopenharmony_cinpm config delete <key> [<key> ...]
131cb0ef41Sopenharmony_cinpm config list [--json]
141cb0ef41Sopenharmony_cinpm config edit
151cb0ef41Sopenharmony_cinpm config fix
161cb0ef41Sopenharmony_ci
171cb0ef41Sopenharmony_cialias: c
181cb0ef41Sopenharmony_ci```
191cb0ef41Sopenharmony_ci
201cb0ef41Sopenharmony_ciNote: This command is unaware of workspaces.
211cb0ef41Sopenharmony_ci
221cb0ef41Sopenharmony_ci### Description
231cb0ef41Sopenharmony_ci
241cb0ef41Sopenharmony_cinpm gets its config settings from the command line, environment
251cb0ef41Sopenharmony_civariables, `npmrc` files, and in some cases, the `package.json` file.
261cb0ef41Sopenharmony_ci
271cb0ef41Sopenharmony_ciSee [npmrc](/configuring-npm/npmrc) for more information about the npmrc
281cb0ef41Sopenharmony_cifiles.
291cb0ef41Sopenharmony_ci
301cb0ef41Sopenharmony_ciSee [config](/using-npm/config) for a more thorough explanation of the
311cb0ef41Sopenharmony_cimechanisms involved, and a full list of config options available.
321cb0ef41Sopenharmony_ci
331cb0ef41Sopenharmony_ciThe `npm config` command can be used to update and edit the contents
341cb0ef41Sopenharmony_ciof the user and global npmrc files.
351cb0ef41Sopenharmony_ci
361cb0ef41Sopenharmony_ci### Sub-commands
371cb0ef41Sopenharmony_ci
381cb0ef41Sopenharmony_ciConfig supports the following sub-commands:
391cb0ef41Sopenharmony_ci
401cb0ef41Sopenharmony_ci#### set
411cb0ef41Sopenharmony_ci
421cb0ef41Sopenharmony_ci```bash
431cb0ef41Sopenharmony_cinpm config set key=value [key=value...]
441cb0ef41Sopenharmony_cinpm set key=value [key=value...]
451cb0ef41Sopenharmony_ci```
461cb0ef41Sopenharmony_ci
471cb0ef41Sopenharmony_ciSets each of the config keys to the value provided. Modifies the user configuration
481cb0ef41Sopenharmony_cifile unless [`location`](/commands/npm-config#location) is passed.
491cb0ef41Sopenharmony_ci
501cb0ef41Sopenharmony_ciIf value is omitted, the key will be removed from your config file entirely.
511cb0ef41Sopenharmony_ci
521cb0ef41Sopenharmony_ciNote: for backwards compatibility, `npm config set key value` is supported
531cb0ef41Sopenharmony_cias an alias for `npm config set key=value`.
541cb0ef41Sopenharmony_ci
551cb0ef41Sopenharmony_ci#### get
561cb0ef41Sopenharmony_ci
571cb0ef41Sopenharmony_ci```bash
581cb0ef41Sopenharmony_cinpm config get [key ...]
591cb0ef41Sopenharmony_cinpm get [key ...]
601cb0ef41Sopenharmony_ci```
611cb0ef41Sopenharmony_ci
621cb0ef41Sopenharmony_ciEcho the config value(s) to stdout.
631cb0ef41Sopenharmony_ci
641cb0ef41Sopenharmony_ciIf multiple keys are provided, then the values will be prefixed with the
651cb0ef41Sopenharmony_cikey names.
661cb0ef41Sopenharmony_ci
671cb0ef41Sopenharmony_ciIf no keys are provided, then this command behaves the same as `npm config
681cb0ef41Sopenharmony_cilist`.
691cb0ef41Sopenharmony_ci
701cb0ef41Sopenharmony_ci#### list
711cb0ef41Sopenharmony_ci
721cb0ef41Sopenharmony_ci```bash
731cb0ef41Sopenharmony_cinpm config list
741cb0ef41Sopenharmony_ci```
751cb0ef41Sopenharmony_ci
761cb0ef41Sopenharmony_ciShow all the config settings. Use `-l` to also show defaults. Use `--json`
771cb0ef41Sopenharmony_cito show the settings in json format.
781cb0ef41Sopenharmony_ci
791cb0ef41Sopenharmony_ci#### delete
801cb0ef41Sopenharmony_ci
811cb0ef41Sopenharmony_ci```bash
821cb0ef41Sopenharmony_cinpm config delete key [key ...]
831cb0ef41Sopenharmony_ci```
841cb0ef41Sopenharmony_ci
851cb0ef41Sopenharmony_ciDeletes the specified keys from all configuration files.
861cb0ef41Sopenharmony_ci
871cb0ef41Sopenharmony_ci#### edit
881cb0ef41Sopenharmony_ci
891cb0ef41Sopenharmony_ci```bash
901cb0ef41Sopenharmony_cinpm config edit
911cb0ef41Sopenharmony_ci```
921cb0ef41Sopenharmony_ci
931cb0ef41Sopenharmony_ciOpens the config file in an editor.  Use the `--global` flag to edit the
941cb0ef41Sopenharmony_ciglobal config.
951cb0ef41Sopenharmony_ci
961cb0ef41Sopenharmony_ci#### fix
971cb0ef41Sopenharmony_ci
981cb0ef41Sopenharmony_ci```bash
991cb0ef41Sopenharmony_cinpm config fix
1001cb0ef41Sopenharmony_ci```
1011cb0ef41Sopenharmony_ci
1021cb0ef41Sopenharmony_ciAttempts to repair invalid configuration items.  Usually this means
1031cb0ef41Sopenharmony_ciattaching authentication config (i.e. `_auth`, `_authToken`) to the
1041cb0ef41Sopenharmony_ciconfigured `registry`.
1051cb0ef41Sopenharmony_ci
1061cb0ef41Sopenharmony_ci### Configuration
1071cb0ef41Sopenharmony_ci
1081cb0ef41Sopenharmony_ci#### `json`
1091cb0ef41Sopenharmony_ci
1101cb0ef41Sopenharmony_ci* Default: false
1111cb0ef41Sopenharmony_ci* Type: Boolean
1121cb0ef41Sopenharmony_ci
1131cb0ef41Sopenharmony_ciWhether or not to output JSON data, rather than the normal output.
1141cb0ef41Sopenharmony_ci
1151cb0ef41Sopenharmony_ci* In `npm pkg set` it enables parsing set values with JSON.parse() before
1161cb0ef41Sopenharmony_ci  saving them to your `package.json`.
1171cb0ef41Sopenharmony_ci
1181cb0ef41Sopenharmony_ciNot supported by all npm commands.
1191cb0ef41Sopenharmony_ci
1201cb0ef41Sopenharmony_ci
1211cb0ef41Sopenharmony_ci
1221cb0ef41Sopenharmony_ci#### `global`
1231cb0ef41Sopenharmony_ci
1241cb0ef41Sopenharmony_ci* Default: false
1251cb0ef41Sopenharmony_ci* Type: Boolean
1261cb0ef41Sopenharmony_ci
1271cb0ef41Sopenharmony_ciOperates in "global" mode, so that packages are installed into the `prefix`
1281cb0ef41Sopenharmony_cifolder instead of the current working directory. See
1291cb0ef41Sopenharmony_ci[folders](/configuring-npm/folders) for more on the differences in behavior.
1301cb0ef41Sopenharmony_ci
1311cb0ef41Sopenharmony_ci* packages are installed into the `{prefix}/lib/node_modules` folder, instead
1321cb0ef41Sopenharmony_ci  of the current working directory.
1331cb0ef41Sopenharmony_ci* bin files are linked to `{prefix}/bin`
1341cb0ef41Sopenharmony_ci* man pages are linked to `{prefix}/share/man`
1351cb0ef41Sopenharmony_ci
1361cb0ef41Sopenharmony_ci
1371cb0ef41Sopenharmony_ci
1381cb0ef41Sopenharmony_ci#### `editor`
1391cb0ef41Sopenharmony_ci
1401cb0ef41Sopenharmony_ci* Default: The EDITOR or VISUAL environment variables, or
1411cb0ef41Sopenharmony_ci  '%SYSTEMROOT%\notepad.exe' on Windows, or 'vi' on Unix systems
1421cb0ef41Sopenharmony_ci* Type: String
1431cb0ef41Sopenharmony_ci
1441cb0ef41Sopenharmony_ciThe command to run for `npm edit` and `npm config edit`.
1451cb0ef41Sopenharmony_ci
1461cb0ef41Sopenharmony_ci
1471cb0ef41Sopenharmony_ci
1481cb0ef41Sopenharmony_ci#### `location`
1491cb0ef41Sopenharmony_ci
1501cb0ef41Sopenharmony_ci* Default: "user" unless `--global` is passed, which will also set this value
1511cb0ef41Sopenharmony_ci  to "global"
1521cb0ef41Sopenharmony_ci* Type: "global", "user", or "project"
1531cb0ef41Sopenharmony_ci
1541cb0ef41Sopenharmony_ciWhen passed to `npm config` this refers to which config file to use.
1551cb0ef41Sopenharmony_ci
1561cb0ef41Sopenharmony_ciWhen set to "global" mode, packages are installed into the `prefix` folder
1571cb0ef41Sopenharmony_ciinstead of the current working directory. See
1581cb0ef41Sopenharmony_ci[folders](/configuring-npm/folders) for more on the differences in behavior.
1591cb0ef41Sopenharmony_ci
1601cb0ef41Sopenharmony_ci* packages are installed into the `{prefix}/lib/node_modules` folder, instead
1611cb0ef41Sopenharmony_ci  of the current working directory.
1621cb0ef41Sopenharmony_ci* bin files are linked to `{prefix}/bin`
1631cb0ef41Sopenharmony_ci* man pages are linked to `{prefix}/share/man`
1641cb0ef41Sopenharmony_ci
1651cb0ef41Sopenharmony_ci
1661cb0ef41Sopenharmony_ci
1671cb0ef41Sopenharmony_ci#### `long`
1681cb0ef41Sopenharmony_ci
1691cb0ef41Sopenharmony_ci* Default: false
1701cb0ef41Sopenharmony_ci* Type: Boolean
1711cb0ef41Sopenharmony_ci
1721cb0ef41Sopenharmony_ciShow extended information in `ls`, `search`, and `help-search`.
1731cb0ef41Sopenharmony_ci
1741cb0ef41Sopenharmony_ci
1751cb0ef41Sopenharmony_ci
1761cb0ef41Sopenharmony_ci### See Also
1771cb0ef41Sopenharmony_ci
1781cb0ef41Sopenharmony_ci* [npm folders](/configuring-npm/folders)
1791cb0ef41Sopenharmony_ci* [npm config](/commands/npm-config)
1801cb0ef41Sopenharmony_ci* [package.json](/configuring-npm/package-json)
1811cb0ef41Sopenharmony_ci* [npmrc](/configuring-npm/npmrc)
1821cb0ef41Sopenharmony_ci* [npm](/commands/npm)
183