patch-1
@reggi/path-to-regexp
dependabot/npm_and_yarn/main/copy-to-clipboard-4.0.2
dependabot/npm_and_yarn/main/eslint-10.4.0
dependabot/npm_and_yarn/main/npmcli/eslint-config-7.0.0
dependabot/npm_and_yarn/main/proc-log-7.0.0
dependabot/npm_and_yarn/npm_and_yarn-826852524d
dependabot/npm_and_yarn/npm_and_yarn-ab9a7f4bc2
deprecate-totp-2fa
dhei/classic-tokens
gat-bypass-2fa-docs
jpg619/fix-accessibility-content-flow
jpg619/version-bump-tar-2
kartykp/gat-bypass-2fa-docs
kartykp/upgrade-path-to-regex
main
maitxn/version-bump-tar
patch-1
reggi/cache-based-on-version
reggi/dev-engines
reggi/fix-transform-prettier
reggi/overrides
update-search-sensitivity
| 1 | --- |
| 2 | title: npm-config |
| 3 | section: 1 |
| 4 | description: Manage the npm configuration files |
| 5 | github_repo: npm/cli |
| 6 | github_branch: release/v7 |
| 7 | github_path: docs/content/commands/npm-config.md |
| 8 | redirect_from: |
| 9 | - /cli-documentation/v7/cli-commands/config |
| 10 | - /cli-documentation/v7/cli-commands/npm-config |
| 11 | - /cli-documentation/v7/commands/config |
| 12 | - /cli-documentation/v7/commands/npm-config |
| 13 | - /cli-documentation/v7/config |
| 14 | - /cli-documentation/v7/npm-config |
| 15 | - /cli/v7/cli-commands/config |
| 16 | - /cli/v7/cli-commands/npm-config |
| 17 | - /cli/v7/commands/config |
| 18 | - /cli/v7/config |
| 19 | - /cli/v7/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 set <key>=<value> [<key>=<value> ...] |
| 31 | npm get [<key> [<key> ...]] |
| 32 | |
| 33 | alias: c |
| 34 | ``` |
| 35 | |
| 36 | Note: This command is unaware of workspaces. |
| 37 | |
| 38 | ### Description |
| 39 | |
| 40 | npm gets its config settings from the command line, environment variables, `npmrc` files, and in some cases, the `package.json` file. |
| 41 | |
| 42 | See [npmrc](/cli/v7/configuring-npm/npmrc) for more information about the npmrc files. |
| 43 | |
| 44 | See [config(7)](/cli/v7/using-npm/config) for a more thorough explanation of the mechanisms involved, and a full list of config options available. |
| 45 | |
| 46 | The `npm config` command can be used to update and edit the contents of the user and global npmrc files. |
| 47 | |
| 48 | ### Sub-commands |
| 49 | |
| 50 | Config supports the following sub-commands: |
| 51 | |
| 52 | #### set |
| 53 | |
| 54 | ```bash |
| 55 | npm config set key=value [key=value...] |
| 56 | npm set key=value [key=value...] |
| 57 | ``` |
| 58 | |
| 59 | Sets each of the config keys to the value provided. |
| 60 | |
| 61 | If value is omitted, then it sets it to an empty string. |
| 62 | |
| 63 | Note: for backwards compatibility, `npm config set key value` is supported as an alias for `npm config set key=value`. |
| 64 | |
| 65 | #### get |
| 66 | |
| 67 | ```bash |
| 68 | npm config get [key ...] |
| 69 | npm get [key ...] |
| 70 | ``` |
| 71 | |
| 72 | Echo the config value(s) to stdout. |
| 73 | |
| 74 | If multiple keys are provided, then the values will be prefixed with the key names. |
| 75 | |
| 76 | If no keys are provided, then this command behaves the same as `npm config list`. |
| 77 | |
| 78 | #### list |
| 79 | |
| 80 | ```bash |
| 81 | npm config list |
| 82 | ``` |
| 83 | |
| 84 | Show all the config settings. Use `-l` to also show defaults. Use `--json` to show the settings in json format. |
| 85 | |
| 86 | #### delete |
| 87 | |
| 88 | ```bash |
| 89 | npm config delete key [key ...] |
| 90 | ``` |
| 91 | |
| 92 | Deletes the specified keys from all configuration files. |
| 93 | |
| 94 | #### edit |
| 95 | |
| 96 | ```bash |
| 97 | npm config edit |
| 98 | ``` |
| 99 | |
| 100 | Opens the config file in an editor. Use the `--global` flag to edit the global config. |
| 101 | |
| 102 | ### Configuration |
| 103 | |
| 104 | #### `json` |
| 105 | |
| 106 | - Default: false |
| 107 | - Type: Boolean |
| 108 | |
| 109 | Whether or not to output JSON data, rather than the normal output. |
| 110 | |
| 111 | - In `npm pkg set` it enables parsing set values with JSON.parse() before saving them to your `package.json`. |
| 112 | |
| 113 | Not supported by all npm commands. |
| 114 | |
| 115 | #### `global` |
| 116 | |
| 117 | - Default: false |
| 118 | - Type: Boolean |
| 119 | |
| 120 | Operates in "global" mode, so that packages are installed into the `prefix` folder instead of the current working directory. See [folders](/cli/v7/configuring-npm/folders) for more on the differences in behavior. |
| 121 | |
| 122 | - packages are installed into the `{prefix}/lib/node_modules` folder, instead of the current working directory. |
| 123 | - bin files are linked to `{prefix}/bin` |
| 124 | - man pages are linked to `{prefix}/share/man` |
| 125 | |
| 126 | #### `editor` |
| 127 | |
| 128 | - Default: The EDITOR or VISUAL environment variables, or 'notepad.exe' on Windows, or 'vim' on Unix systems |
| 129 | - Type: String |
| 130 | |
| 131 | The command to run for `npm edit` and `npm config edit`. |
| 132 | |
| 133 | #### `location` |
| 134 | |
| 135 | - Default: "user" unless `--global` is passed, which will also set this value to "global" |
| 136 | - Type: "global", "user", or "project" |
| 137 | |
| 138 | When passed to `npm config` this refers to which config file to use. |
| 139 | |
| 140 | #### `long` |
| 141 | |
| 142 | - Default: false |
| 143 | - Type: Boolean |
| 144 | |
| 145 | Show extended information in `ls`, `search`, and `help-search`. |
| 146 | |
| 147 | ### See Also |
| 148 | |
| 149 | - [npm folders](/cli/v7/configuring-npm/folders) |
| 150 | - [npm config](/cli/v7/commands/npm-config) |
| 151 | - [package.json](/cli/v7/configuring-npm/package-json) |
| 152 | - [npmrc](/cli/v7/configuring-npm/npmrc) |
| 153 | - [npm](/cli/v7/commands/npm) |