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