1 ---
2 title: config
3 section: 7
4 description: More than you probably want to know about npm configuration
5 github_repo: npm/cli
6 github_branch: release/v8
7 github_path: docs/lib/content/using-npm/config.md
8 redirect_from:
9 - /cli-documentation/v8/misc/config
10 - /cli-documentation/v8/using-npm/config
11 - /cli/v8/misc/config
12 ---
13
14 ### Description
15
16 npm gets its configuration values from the following sources, sorted by priority:
17
18 #### Command Line Flags
19
20 Putting `--foo bar` on the command line sets the `foo` configuration parameter to `"bar"`. A `--` argument tells the cli parser to stop reading flags. Using `--flag` without specifying any value will set the value to `true`.
21
22 Example: `--flag1 --flag2` will set both configuration parameters to `true`, while `--flag1 --flag2 bar` will set `flag1` to `true`, and `flag2` to `bar`. Finally, `--flag1 --flag2 -- bar` will set both configuration parameters to `true`, and the `bar` is taken as a command argument.
23
24 #### Environment Variables
25
26 Any environment variables that start with `npm_config_` will be interpreted as a configuration parameter. For example, putting `npm_config_foo=bar` in your environment will set the `foo` configuration parameter to `bar`. Any environment configurations that are not given a value will be given the value of `true`. Config values are case-insensitive, so `NPM_CONFIG_FOO=bar` will work the same. However, please note that inside [`scripts`](/cli/v8/using-npm/scripts) npm will set its own environment variables and Node will prefer those lowercase versions over any uppercase ones that you might set. For details see [this issue](https://github.com/npm/npm/issues/14528).
27
28 Notice that you need to use underscores instead of dashes, so `--allow-same-version` would become `npm_config_allow_same_version=true`.
29
30 #### npmrc Files
31
32 The four relevant files are:
33
34 - per-project configuration file (`/path/to/my/project/.npmrc`)
35 - per-user configuration file (defaults to `$HOME/.npmrc`; configurable via CLI option `--userconfig` or environment variable `$NPM_CONFIG_USERCONFIG`)
36 - global configuration file (defaults to `$PREFIX/etc/npmrc`; configurable via CLI option `--globalconfig` or environment variable `$NPM_CONFIG_GLOBALCONFIG`)
37 - npm's built-in configuration file (`/path/to/npm/npmrc`)
38
39 See [npmrc](/cli/v8/configuring-npm/npmrc) for more details.
40
41 #### Default Configs
42
43 Run `npm config ls -l` to see a set of configuration parameters that are internal to npm, and are defaults if nothing else is specified.
44
45 ### Shorthands and Other CLI Niceties
46
47 The following shorthands are parsed on the command-line:
48
49 - `-a`: `--all`
50 - `--enjoy-by`: `--before`
51 - `-c`: `--call`
52 - `--desc`: `--description`
53 - `-f`: `--force`
54 - `-g`: `--global`
55 - `--iwr`: `--include-workspace-root`
56 - `-L`: `--location`
57 - `-d`: `--loglevel info`
58 - `-s`: `--loglevel silent`
59 - `--silent`: `--loglevel silent`
60 - `--ddd`: `--loglevel silly`
61 - `--dd`: `--loglevel verbose`
62 - `--verbose`: `--loglevel verbose`
63 - `-q`: `--loglevel warn`
64 - `--quiet`: `--loglevel warn`
65 - `-l`: `--long`
66 - `-m`: `--message`
67 - `--local`: `--no-global`
68 - `-n`: `--no-yes`
69 - `--no`: `--no-yes`
70 - `-p`: `--parseable`
71 - `--porcelain`: `--parseable`
72 - `-C`: `--prefix`
73 - `--readonly`: `--read-only`
74 - `--reg`: `--registry`
75 - `-S`: `--save`
76 - `-B`: `--save-bundle`
77 - `-D`: `--save-dev`
78 - `-E`: `--save-exact`
79 - `-O`: `--save-optional`
80 - `-P`: `--save-prod`
81 - `-?`: `--usage`
82 - `-h`: `--usage`
83 - `-H`: `--usage`
84 - `--help`: `--usage`
85 - `-v`: `--version`
86 - `-w`: `--workspace`
87 - `--ws`: `--workspaces`
88 - `-y`: `--yes`
89
90 If the specified configuration param resolves unambiguously to a known configuration parameter, then it is expanded to that configuration parameter. For example:
91
92 ```bash
93 npm ls --par
94 # same as:
95 npm ls --parseable
96 ```
97
98 If multiple single-character shorthands are strung together, and the resulting combination is unambiguously not some other configuration param, then it is expanded to its various component pieces. For example:
99
100 ```bash
101 npm ls -gpld
102 # same as:
103 npm ls --global --parseable --long --loglevel info
104 ```
105
106 ### Config Settings
107
108 #### `_auth`
109
110 - Default: null
111 - Type: null or String
112
113 A basic-auth string to use when authenticating against the npm registry. This will ONLY be used to authenticate against the npm registry. For other registries you will need to scope it like "//other-registry.tld/:\_auth"
114
115 Warning: This should generally not be set via a command-line option. It is safer to use a registry-provided authentication bearer token stored in the ~/.npmrc file by running `npm login`.
116
117 #### `access`
118
119 - Default: 'restricted' for scoped packages, 'public' for unscoped packages
120 - Type: null, "restricted", or "public"
121
122 When publishing scoped packages, the access level defaults to `restricted`. If you want your scoped package to be publicly viewable (and installable) set `--access=public`. The only valid values for `access` are `public` and `restricted`. Unscoped packages _always_ have an access level of `public`.
123
124 Note: Using the `--access` flag on the `npm publish` command will only set the package access level on the initial publish of the package. Any subsequent `npm publish` commands using the `--access` flag will not have an effect to the access level. To make changes to the access level after the initial publish use `npm access`.
125
126 #### `all`
127
128 - Default: false
129 - Type: Boolean
130
131 When running `npm outdated` and `npm ls`, setting `--all` will show all outdated or installed packages, rather than only those directly depended upon by the current project.
132
133 #### `allow-same-version`
134
135 - Default: false
136 - Type: Boolean
137
138 Prevents throwing an error when `npm version` is used to set the new version to the same value as the current version.
139
140 #### `audit`
141
142 - Default: true
143 - Type: Boolean
144
145 When "true" submit audit reports alongside the current npm command to the default registry and all registries configured for scopes. See the documentation for [`npm audit`](/cli/v8/commands/npm-audit) for details on what is submitted.
146
147 #### `audit-level`
148
149 - Default: null
150 - Type: null, "info", "low", "moderate", "high", "critical", or "none"
151
152 The minimum level of vulnerability for `npm audit` to exit with a non-zero exit code.
153
154 #### `auth-type`
155
156 - Default: "legacy"
157 - Type: "legacy", "web", "sso", "saml", "oauth", or "webauthn"
158
159 NOTE: auth-type values "sso", "saml", "oauth", and "webauthn" will be removed in a future version.
160
161 What authentication strategy to use with `login`.
162
163 #### `before`
164
165 - Default: null
166 - Type: null or Date
167
168 If passed to `npm install`, will rebuild the npm tree such that only versions that were available **on or before** the `--before` time get installed. If there's no versions available for the current set of direct dependencies, the command will error.
169
170 If the requested version is a `dist-tag` and the given tag does not pass the `--before` filter, the most recent version less than or equal to that tag will be used. For example, `foo@latest` might install `foo@1.2` even though `latest` is `2.0`.
171
172 #### `bin-links`
173
174 - Default: true
175 - Type: Boolean
176
177 Tells npm to create symlinks (or `.cmd` shims on Windows) for package executables.
178
179 Set to false to have it not do this. This can be used to work around the fact that some file systems don't support symlinks, even on ostensibly Unix systems.
180
181 #### `browser`
182
183 - Default: OS X: `"open"`, Windows: `"start"`, Others: `"xdg-open"`
184 - Type: null, Boolean, or String
185
186 The browser that is called by npm commands to open websites.
187
188 Set to `false` to suppress browser behavior and instead print urls to terminal.
189
190 Set to `true` to use default system URL opener.
191
192 #### `ca`
193
194 - Default: null
195 - Type: null or String (can be set multiple times)
196
197 The Certificate Authority signing certificate that is trusted for SSL connections to the registry. Values should be in PEM format (Windows calls it "Base-64 encoded X.509 (.CER)") with newlines replaced by the string "\n". For example:
198
199 ```ini
200 ca="-----BEGIN CERTIFICATE-----\nXXXX\nXXXX\n-----END CERTIFICATE-----"
201 ```
202
203 Set to `null` to only allow "known" registrars, or to a specific CA cert to trust only that specific signing authority.
204
205 Multiple CAs can be trusted by specifying an array of certificates:
206
207 ```ini
208 ca[]="..."
209 ca[]="..."
210 ```
211
212 See also the `strict-ssl` config.
213
214 #### `cache`
215
216 - Default: Windows: `%LocalAppData%\npm-cache`, Posix: `~/.npm`
217 - Type: Path
218
219 The location of npm's cache directory. See [`npm cache`](/cli/v8/commands/npm-cache)
220
221 #### `cafile`
222
223 - Default: null
224 - Type: Path
225
226 A path to a file containing one or multiple Certificate Authority signing certificates. Similar to the `ca` setting, but allows for multiple CA's, as well as for the CA information to be stored in a file on disk.
227
228 #### `call`
229
230 - Default: ""
231 - Type: String
232
233 Optional companion option for `npm exec`, `npx` that allows for specifying a custom command to be run along with the installed packages.
234
235 ```bash
236 npm exec --package yo --package generator-node --call "yo node"
237 ```
238
239 #### `cert`
240
241 - Default: null
242 - Type: null or String
243
244 A client certificate to pass when accessing the registry. Values should be in PEM format (Windows calls it "Base-64 encoded X.509 (.CER)") with newlines replaced by the string "\n". For example:
245
246 ```ini
247 cert="-----BEGIN CERTIFICATE-----\nXXXX\nXXXX\n-----END CERTIFICATE-----"
248 ```
249
250 It is _not_ the path to a certificate file, though you can set a registry-scoped "certfile" path like "//other-registry.tld/:certfile=/path/to/cert.pem".
251
252 #### `ci-name`
253
254 - Default: The name of the current CI system, or `null` when not on a known CI platform.
255 - Type: null or String
256
257 The name of a continuous integration system. If not set explicitly, npm will detect the current CI environment using the [`@npmcli/ci-detect`](http://npm.im/@npmcli/ci-detect) module.
258
259 #### `cidr`
260
261 - Default: null
262 - Type: null or String (can be set multiple times)
263
264 This is a list of CIDR address to be used when configuring limited access tokens with the `npm token create` command.
265
266 #### `color`
267
268 - Default: true unless the NO_COLOR environ is set to something other than '0'
269 - Type: "always" or Boolean
270
271 If false, never shows colors. If `"always"` then always shows colors. If true, then only prints color codes for tty file descriptors.
272
273 #### `commit-hooks`
274
275 - Default: true
276 - Type: Boolean
277
278 Run git commit hooks when using the `npm version` command.
279
280 #### `depth`
281
282 - Default: `Infinity` if `--all` is set, otherwise `1`
283 - Type: null or Number
284
285 The depth to go when recursing packages for `npm ls`.
286
287 If not set, `npm ls` will show only the immediate dependencies of the root project. If `--all` is set, then npm will show all dependencies by default.
288
289 #### `description`
290
291 - Default: true
292 - Type: Boolean
293
294 Show the description in `npm search`
295
296 #### `diff`
297
298 - Default:
299 - Type: String (can be set multiple times)
300
301 Define arguments to compare in `npm diff`.
302
303 #### `diff-dst-prefix`
304
305 - Default: "b/"
306 - Type: String
307
308 Destination prefix to be used in `npm diff` output.
309
310 #### `diff-ignore-all-space`
311
312 - Default: false
313 - Type: Boolean
314
315 Ignore whitespace when comparing lines in `npm diff`.
316
317 #### `diff-name-only`
318
319 - Default: false
320 - Type: Boolean
321
322 Prints only filenames when using `npm diff`.
323
324 #### `diff-no-prefix`
325
326 - Default: false
327 - Type: Boolean
328
329 Do not show any source or destination prefix in `npm diff` output.
330
331 Note: this causes `npm diff` to ignore the `--diff-src-prefix` and `--diff-dst-prefix` configs.
332
333 #### `diff-src-prefix`
334
335 - Default: "a/"
336 - Type: String
337
338 Source prefix to be used in `npm diff` output.
339
340 #### `diff-text`
341
342 - Default: false
343 - Type: Boolean
344
345 Treat all files as text in `npm diff`.
346
347 #### `diff-unified`
348
349 - Default: 3
350 - Type: Number
351
352 The number of lines of context to print in `npm diff`.
353
354 #### `dry-run`
355
356 - Default: false
357 - Type: Boolean
358
359 Indicates that you don't want npm to make any changes and that it should only report what it would have done. This can be passed into any of the commands that modify your local installation, eg, `install`, `update`, `dedupe`, `uninstall`, as well as `pack` and `publish`.
360
361 Note: This is NOT honored by other network related commands, eg `dist-tags`, `owner`, etc.
362
363 #### `editor`
364
365 - Default: The EDITOR or VISUAL environment variables, or 'notepad.exe' on Windows, or 'vim' on Unix systems
366 - Type: String
367
368 The command to run for `npm edit` and `npm config edit`.
369
370 #### `engine-strict`
371
372 - Default: false
373 - Type: Boolean
374
375 If set to true, then npm will stubbornly refuse to install (or even consider installing) any package that claims to not be compatible with the current Node.js version.
376
377 This can be overridden by setting the `--force` flag.
378
379 #### `fetch-retries`
380
381 - Default: 2
382 - Type: Number
383
384 The "retries" config for the `retry` module to use when fetching packages from the registry.
385
386 npm will retry idempotent read requests to the registry in the case of network failures or 5xx HTTP errors.
387
388 #### `fetch-retry-factor`
389
390 - Default: 10
391 - Type: Number
392
393 The "factor" config for the `retry` module to use when fetching packages.
394
395 #### `fetch-retry-maxtimeout`
396
397 - Default: 60000 (1 minute)
398 - Type: Number
399
400 The "maxTimeout" config for the `retry` module to use when fetching packages.
401
402 #### `fetch-retry-mintimeout`
403
404 - Default: 10000 (10 seconds)
405 - Type: Number
406
407 The "minTimeout" config for the `retry` module to use when fetching packages.
408
409 #### `fetch-timeout`
410
411 - Default: 300000 (5 minutes)
412 - Type: Number
413
414 The maximum amount of time to wait for HTTP requests to complete.
415
416 #### `force`
417
418 - Default: false
419 - Type: Boolean
420
421 Removes various protections against unfortunate side effects, common mistakes, unnecessary performance degradation, and malicious input.
422
423 - Allow clobbering non-npm files in global installs.
424 - Allow the `npm version` command to work on an unclean git repository.
425 - Allow deleting the cache folder with `npm cache clean`.
426 - Allow installing packages that have an `engines` declaration requiring a different version of npm.
427 - Allow installing packages that have an `engines` declaration requiring a different version of `node`, even if `--engine-strict` is enabled.
428 - Allow `npm audit fix` to install modules outside your stated dependency range (including SemVer-major changes).
429 - Allow unpublishing all versions of a published package.
430 - Allow conflicting peerDependencies to be installed in the root project.
431 - Implicitly set `--yes` during `npm init`.
432 - Allow clobbering existing values in `npm pkg`
433 - Allow unpublishing of entire packages (not just a single version).
434
435 If you don't have a clear idea of what you want to do, it is strongly recommended that you do not use this option!
436
437 #### `foreground-scripts`
438
439 - Default: false
440 - Type: Boolean
441
442 Run all build scripts (ie, `preinstall`, `install`, and `postinstall`) scripts for installed packages in the foreground process, sharing standard input, output, and error with the main npm process.
443
444 Note that this will generally make installs run slower, and be much noisier, but can be useful for debugging.
445
446 #### `format-package-lock`
447
448 - Default: true
449 - Type: Boolean
450
451 Format `package-lock.json` or `npm-shrinkwrap.json` as a human readable file.
452
453 #### `fund`
454
455 - Default: true
456 - Type: Boolean
457
458 When "true" displays the message at the end of each `npm install` acknowledging the number of dependencies looking for funding. See [`npm fund`](/cli/v8/commands/npm-fund) for details.
459
460 #### `git`
461
462 - Default: "git"
463 - Type: String
464
465 The command to use for git commands. If git is installed on the computer, but is not in the `PATH`, then set this to the full path to the git binary.
466
467 #### `git-tag-version`
468
469 - Default: true
470 - Type: Boolean
471
472 Tag the commit when using the `npm version` command. Setting this to false results in no commit being made at all.
473
474 #### `global`
475
476 - Default: false
477 - Type: Boolean
478
479 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.
480
481 - packages are installed into the `{prefix}/lib/node_modules` folder, instead of the current working directory.
482 - bin files are linked to `{prefix}/bin`
483 - man pages are linked to `{prefix}/share/man`
484
485 #### `global-style`
486
487 - Default: false
488 - Type: Boolean
489
490 Causes npm to install the package into your local `node_modules` folder with the same layout it uses with the global `node_modules` folder. Only your direct dependencies will show in `node_modules` and everything they depend on will be flattened in their `node_modules` folders. This obviously will eliminate some deduping. If used with `legacy-bundling`, `legacy-bundling` will be preferred.
491
492 #### `globalconfig`
493
494 - Default: The global --prefix setting plus 'etc/npmrc'. For example, '/usr/local/etc/npmrc'
495 - Type: Path
496
497 The config file to read for global config options.
498
499 #### `heading`
500
501 - Default: "npm"
502 - Type: String
503
504 The string that starts all the debugging log output.
505
506 #### `https-proxy`
507
508 - Default: null
509 - Type: null or URL
510
511 A proxy to use for outgoing https requests. If the `HTTPS_PROXY` or `https_proxy` or `HTTP_PROXY` or `http_proxy` environment variables are set, proxy settings will be honored by the underlying `make-fetch-happen` library.
512
513 #### `if-present`
514
515 - Default: false
516 - Type: Boolean
517
518 If true, npm will not exit with an error code when `run-script` is invoked for a script that isn't defined in the `scripts` section of `package.json`. This option can be used when it's desirable to optionally run a script when it's present and fail if the script fails. This is useful, for example, when running scripts that may only apply for some builds in an otherwise generic CI setup.
519
520 This value is not exported to the environment for child processes.
521
522 #### `ignore-scripts`
523
524 - Default: false
525 - Type: Boolean
526
527 If true, npm does not run scripts specified in package.json files.
528
529 Note that commands explicitly intended to run a particular script, such as `npm start`, `npm stop`, `npm restart`, `npm test`, and `npm run-script` will still run their intended script if `ignore-scripts` is set, but they will _not_ run any pre- or post-scripts.
530
531 #### `include`
532
533 - Default:
534 - Type: "prod", "dev", "optional", or "peer" (can be set multiple times)
535
536 Option that allows for defining which types of dependencies to install.
537
538 This is the inverse of `--omit=<type>`.
539
540 Dependency types specified in `--include` will not be omitted, regardless of the order in which omit/include are specified on the command-line.
541
542 #### `include-staged`
543
544 - Default: false
545 - Type: Boolean
546
547 Allow installing "staged" published packages, as defined by [npm RFC PR #92](https://github.com/npm/rfcs/pull/92).
548
549 This is experimental, and not implemented by the npm public registry.
550
551 #### `include-workspace-root`
552
553 - Default: false
554 - Type: Boolean
555
556 Include the workspace root when workspaces are enabled for a command.
557
558 When false, specifying individual workspaces via the `workspace` config, or all workspaces via the `workspaces` flag, will cause npm to operate only on the specified workspaces, and not on the root project.
559
560 This value is not exported to the environment for child processes.
561
562 #### `init-author-email`
563
564 - Default: ""
565 - Type: String
566
567 The value `npm init` should use by default for the package author's email.
568
569 #### `init-author-name`
570
571 - Default: ""
572 - Type: String
573
574 The value `npm init` should use by default for the package author's name.
575
576 #### `init-author-url`
577
578 - Default: ""
579 - Type: "" or URL
580
581 The value `npm init` should use by default for the package author's homepage.
582
583 #### `init-license`
584
585 - Default: "ISC"
586 - Type: String
587
588 The value `npm init` should use by default for the package license.
589
590 #### `init-module`
591
592 - Default: "~/.npm-init.js"
593 - Type: Path
594
595 A module that will be loaded by the `npm init` command. See the documentation for the [init-package-json](https://github.com/npm/init-package-json) module for more information, or [npm init](/cli/v8/commands/npm-init).
596
597 #### `init-version`
598
599 - Default: "1.0.0"
600 - Type: SemVer string
601
602 The value that `npm init` should use by default for the package version number, if not already set in package.json.
603
604 #### `install-links`
605
606 - Default: false
607 - Type: Boolean
608
609 When set file: protocol dependencies that exist outside of the project root will be packed and installed as regular dependencies instead of creating a symlink. This option has no effect on workspaces.
610
611 #### `json`
612
613 - Default: false
614 - Type: Boolean
615
616 Whether or not to output JSON data, rather than the normal output.
617
618 - In `npm pkg set` it enables parsing set values with JSON.parse() before saving them to your `package.json`.
619
620 Not supported by all npm commands.
621
622 #### `key`
623
624 - Default: null
625 - Type: null or String
626
627 A client key to pass when accessing the registry. Values should be in PEM format with newlines replaced by the string "\n". For example:
628
629 ```ini
630 key="-----BEGIN PRIVATE KEY-----\nXXXX\nXXXX\n-----END PRIVATE KEY-----"
631 ```
632
633 It is _not_ the path to a key file, though you can set a registry-scoped "keyfile" path like "//other-registry.tld/:keyfile=/path/to/key.pem".
634
635 #### `legacy-bundling`
636
637 - Default: false
638 - Type: Boolean
639
640 Causes npm to install the package such that versions of npm prior to 1.4, such as the one included with node 0.8, can install the package. This eliminates all automatic deduping. If used with `global-style` this option will be preferred.
641
642 #### `legacy-peer-deps`
643
644 - Default: false
645 - Type: Boolean
646
647 Causes npm to completely ignore `peerDependencies` when building a package tree, as in npm versions 3 through 6.
648
649 If a package cannot be installed because of overly strict `peerDependencies` that collide, it provides a way to move forward resolving the situation.
650
651 This differs from `--omit=peer`, in that `--omit=peer` will avoid unpacking `peerDependencies` on disk, but will still design a tree such that `peerDependencies` _could_ be unpacked in a correct place.
652
653 Use of `legacy-peer-deps` is not recommended, as it will not enforce the `peerDependencies` contract that meta-dependencies may rely on.
654
655 #### `link`
656
657 - Default: false
658 - Type: Boolean
659
660 Used with `npm ls`, limiting output to only those packages that are linked.
661
662 #### `local-address`
663
664 - Default: null
665 - Type: IP Address
666
667 The IP address of the local interface to use when making connections to the npm registry. Must be IPv4 in versions of Node prior to 0.12.
668
669 #### `location`
670
671 - Default: "user" unless `--global` is passed, which will also set this value to "global"
672 - Type: "global", "user", or "project"
673
674 When passed to `npm config` this refers to which config file to use.
675
676 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.
677
678 - packages are installed into the `{prefix}/lib/node_modules` folder, instead of the current working directory.
679 - bin files are linked to `{prefix}/bin`
680 - man pages are linked to `{prefix}/share/man`
681
682 #### `lockfile-version`
683
684 - Default: Version 2 if no lockfile or current lockfile version less than or equal to 2, otherwise maintain current lockfile version
685 - Type: null, 1, 2, 3, "1", "2", or "3"
686
687 Set the lockfile format version to be used in package-lock.json and npm-shrinkwrap-json files. Possible options are:
688
689 1: The lockfile version used by npm versions 5 and 6. Lacks some data that is used during the install, resulting in slower and possibly less deterministic installs. Prevents lockfile churn when interoperating with older npm versions.
690
691 2: The default lockfile version used by npm version 7. Includes both the version 1 lockfile data and version 3 lockfile data, for maximum determinism and interoperability, at the expense of more bytes on disk.
692
693 3: Only the new lockfile information introduced in npm version 7. Smaller on disk than lockfile version 2, but not interoperable with older npm versions. Ideal if all users are on npm version 7 and higher.
694
695 #### `loglevel`
696
697 - Default: "notice"
698 - Type: "silent", "error", "warn", "notice", "http", "timing", "info", "verbose", or "silly"
699
700 What level of logs to report. All logs are written to a debug log, with the path to that file printed if the execution of a command fails.
701
702 Any logs of a higher level than the setting are shown. The default is "notice".
703
704 See also the `foreground-scripts` config.
705
706 #### `logs-dir`
707
708 - Default: A directory named `_logs` inside the cache
709 - Type: null or Path
710
711 The location of npm's log directory. See [`npm logging`](/cli/v8/using-npm/logging) for more information.
712
713 #### `logs-max`
714
715 - Default: 10
716 - Type: Number
717
718 The maximum number of log files to store.
719
720 If set to 0, no log files will be written for the current run.
721
722 #### `long`
723
724 - Default: false
725 - Type: Boolean
726
727 Show extended information in `ls`, `search`, and `help-search`.
728
729 #### `maxsockets`
730
731 - Default: 15
732 - Type: Number
733
734 The maximum number of connections to use per origin (protocol/host/port combination).
735
736 #### `message`
737
738 - Default: "%s"
739 - Type: String
740
741 Commit message which is used by `npm version` when creating version commit.
742
743 Any "%s" in the message will be replaced with the version number.
744
745 #### `node-options`
746
747 - Default: null
748 - Type: null or String
749
750 Options to pass through to Node.js via the `NODE_OPTIONS` environment variable. This does not impact how npm itself is executed but it does impact how lifecycle scripts are called.
751
752 #### `node-version`
753
754 - Default: Node.js `process.version` value
755 - Type: SemVer string
756
757 The node version to use when checking a package's `engines` setting.
758
759 #### `noproxy`
760
761 - Default: The value of the NO_PROXY environment variable
762 - Type: String (can be set multiple times)
763
764 Domain extensions that should bypass any proxies.
765
766 Also accepts a comma-delimited string.
767
768 #### `npm-version`
769
770 - Default: Output of `npm --version`
771 - Type: SemVer string
772
773 The npm version to use when checking a package's `engines` setting.
774
775 #### `offline`
776
777 - Default: false
778 - Type: Boolean
779
780 Force offline mode: no network requests will be done during install. To allow the CLI to fill in missing cache data, see `--prefer-offline`.
781
782 #### `omit`
783
784 - Default: 'dev' if the `NODE_ENV` environment variable is set to 'production', otherwise empty.
785 - Type: "dev", "optional", or "peer" (can be set multiple times)
786
787 Dependency types to omit from the installation tree on disk.
788
789 Note that these dependencies _are_ still resolved and added to the `package-lock.json` or `npm-shrinkwrap.json` file. They are just not physically installed on disk.
790
791 If a package type appears in both the `--include` and `--omit` lists, then it will be included.
792
793 If the resulting omit list includes `'dev'`, then the `NODE_ENV` environment variable will be set to `'production'` for all lifecycle scripts.
794
795 #### `omit-lockfile-registry-resolved`
796
797 - Default: false
798 - Type: Boolean
799
800 This option causes npm to create lock files without a `resolved` key for registry dependencies. Subsequent installs will need to resolve tarball endpoints with the configured registry, likely resulting in a longer install time.
801
802 #### `otp`
803
804 - Default: null
805 - Type: null or String
806
807 This is a one-time password from a two-factor authenticator. It's needed when publishing or changing package permissions with `npm access`.
808
809 If not set, and a registry response fails with a challenge for a one-time password, npm will prompt on the command line for one.
810
811 #### `pack-destination`
812
813 - Default: "."
814 - Type: String
815
816 Directory in which `npm pack` will save tarballs.
817
818 #### `package`
819
820 - Default:
821 - Type: String (can be set multiple times)
822
823 The package or packages to install for [`npm exec`](/cli/v8/commands/npm-exec)
824
825 #### `package-lock`
826
827 - Default: true
828 - Type: Boolean
829
830 If set to false, then ignore `package-lock.json` files when installing. This will also prevent _writing_ `package-lock.json` if `save` is true.
831
832 This configuration does not affect `npm ci`.
833
834 #### `package-lock-only`
835
836 - Default: false
837 - Type: Boolean
838
839 If set to true, the current operation will only use the `package-lock.json`, ignoring `node_modules`.
840
841 For `update` this means only the `package-lock.json` will be updated, instead of checking `node_modules` and downloading dependencies.
842
843 For `list` this means the output will be based on the tree described by the `package-lock.json`, rather than the contents of `node_modules`.
844
845 #### `parseable`
846
847 - Default: false
848 - Type: Boolean
849
850 Output parseable results from commands that write to standard output. For `npm search`, this will be tab-separated table format.
851
852 #### `prefer-offline`
853
854 - Default: false
855 - Type: Boolean
856
857 If true, staleness checks for cached data will be bypassed, but missing data will be requested from the server. To force full offline mode, use `--offline`.
858
859 #### `prefer-online`
860
861 - Default: false
862 - Type: Boolean
863
864 If true, staleness checks for cached data will be forced, making the CLI look for updates immediately even for fresh package data.
865
866 #### `prefix`
867
868 - Default: In global mode, the folder where the node executable is installed. In local mode, the nearest parent folder containing either a package.json file or a node_modules folder.
869 - Type: Path
870
871 The location to install global items. If set on the command line, then it forces non-global commands to run in the specified folder.
872
873 #### `preid`
874
875 - Default: ""
876 - Type: String
877
878 The "prerelease identifier" to use as a prefix for the "prerelease" part of a semver. Like the `rc` in `1.2.0-rc.8`.
879
880 #### `progress`
881
882 - Default: `true` unless running in a known CI system
883 - Type: Boolean
884
885 When set to `true`, npm will display a progress bar during time intensive operations, if `process.stderr` is a TTY.
886
887 Set to `false` to suppress the progress bar.
888
889 #### `proxy`
890
891 - Default: null
892 - Type: null, false, or URL
893
894 A proxy to use for outgoing http requests. If the `HTTP_PROXY` or `http_proxy` environment variables are set, proxy settings will be honored by the underlying `request` library.
895
896 #### `read-only`
897
898 - Default: false
899 - Type: Boolean
900
901 This is used to mark a token as unable to publish when configuring limited access tokens with the `npm token create` command.
902
903 #### `rebuild-bundle`
904
905 - Default: true
906 - Type: Boolean
907
908 Rebuild bundled dependencies after installation.
909
910 #### `registry`
911
912 - Default: "https://registry.npmjs.org/"
913 - Type: URL
914
915 The base URL of the npm registry.
916
917 #### `replace-registry-host`
918
919 - Default: "npmjs"
920 - Type: "npmjs", "never", "always", or String
921
922 Defines behavior for replacing the registry host in a lockfile with the configured registry.
923
924 The default behavior is to replace package dist URLs from the default registry (https://registry.npmjs.org) to the configured registry. If set to "never", then use the registry value. If set to "always", then replace the registry host with the configured host every time.
925
926 You may also specify a bare hostname (e.g., "registry.npmjs.org").
927
928 #### `save`
929
930 - Default: `true` unless when using `npm update` where it defaults to `false`
931 - Type: Boolean
932
933 Save installed packages to a `package.json` file as dependencies.
934
935 When used with the `npm rm` command, removes the dependency from `package.json`.
936
937 Will also prevent writing to `package-lock.json` if set to `false`.
938
939 #### `save-bundle`
940
941 - Default: false
942 - Type: Boolean
943
944 If a package would be saved at install time by the use of `--save`, `--save-dev`, or `--save-optional`, then also put it in the `bundleDependencies` list.
945
946 Ignored if `--save-peer` is set, since peerDependencies cannot be bundled.
947
948 #### `save-dev`
949
950 - Default: false
951 - Type: Boolean
952
953 Save installed packages to a package.json file as `devDependencies`.
954
955 #### `save-exact`
956
957 - Default: false
958 - Type: Boolean
959
960 Dependencies saved to package.json will be configured with an exact version rather than using npm's default semver range operator.
961
962 #### `save-optional`
963
964 - Default: false
965 - Type: Boolean
966
967 Save installed packages to a package.json file as `optionalDependencies`.
968
969 #### `save-peer`
970
971 - Default: false
972 - Type: Boolean
973
974 Save installed packages to a package.json file as `peerDependencies`
975
976 #### `save-prefix`
977
978 - Default: "^"
979 - Type: String
980
981 Configure how versions of packages installed to a package.json file via `--save` or `--save-dev` get prefixed.
982
983 For example if a package has version `1.2.3`, by default its version is set to `^1.2.3` which allows minor upgrades for that package, but after `npm config set save-prefix='~'` it would be set to `~1.2.3` which only allows patch upgrades.
984
985 #### `save-prod`
986
987 - Default: false
988 - Type: Boolean
989
990 Save installed packages into `dependencies` specifically. This is useful if a package already exists in `devDependencies` or `optionalDependencies`, but you want to move it to be a non-optional production dependency.
991
992 This is the default behavior if `--save` is true, and neither `--save-dev` or `--save-optional` are true.
993
994 #### `scope`
995
996 - Default: the scope of the current project, if any, or ""
997 - Type: String
998
999 Associate an operation with a scope for a scoped registry.
1000
1001 Useful when logging in to or out of a private registry:
1002
1003 ```
1004 # log in, linking the scope to the custom registry
1005 npm login --scope=@mycorp --registry=https://registry.mycorp.com
1006
1007 # log out, removing the link and the auth token
1008 npm logout --scope=@mycorp
1009 ```
1010
1011 This will cause `@mycorp` to be mapped to the registry for future installation of packages specified according to the pattern `@mycorp/package`.
1012
1013 This will also cause `npm init` to create a scoped package.
1014
1015 ```
1016 # accept all defaults, and create a package named "@foo/whatever",
1017 # instead of just named "whatever"
1018 npm init --scope=@foo --yes
1019 ```
1020
1021 #### `script-shell`
1022
1023 - Default: '/bin/sh' on POSIX systems, 'cmd.exe' on Windows
1024 - Type: null or String
1025
1026 The shell to use for scripts run with the `npm exec`, `npm run` and `npm init <package-spec>` commands.
1027
1028 #### `searchexclude`
1029
1030 - Default: ""
1031 - Type: String
1032
1033 Space-separated options that limit the results from search.
1034
1035 #### `searchlimit`
1036
1037 - Default: 20
1038 - Type: Number
1039
1040 Number of items to limit search results to. Will not apply at all to legacy searches.
1041
1042 #### `searchopts`
1043
1044 - Default: ""
1045 - Type: String
1046
1047 Space-separated options that are always passed to search.
1048
1049 #### `searchstaleness`
1050
1051 - Default: 900
1052 - Type: Number
1053
1054 The age of the cache, in seconds, before another registry request is made if using legacy search endpoint.
1055
1056 #### `shell`
1057
1058 - Default: SHELL environment variable, or "bash" on Posix, or "cmd.exe" on Windows
1059 - Type: String
1060
1061 The shell to run for the `npm explore` command.
1062
1063 #### `sign-git-commit`
1064
1065 - Default: false
1066 - Type: Boolean
1067
1068 If set to true, then the `npm version` command will commit the new package version using `-S` to add a signature.
1069
1070 Note that git requires you to have set up GPG keys in your git configs for this to work properly.
1071
1072 #### `sign-git-tag`
1073
1074 - Default: false
1075 - Type: Boolean
1076
1077 If set to true, then the `npm version` command will tag the version using `-s` to add a signature.
1078
1079 Note that git requires you to have set up GPG keys in your git configs for this to work properly.
1080
1081 #### `strict-peer-deps`
1082
1083 - Default: false
1084 - Type: Boolean
1085
1086 If set to `true`, and `--legacy-peer-deps` is not set, then _any_ conflicting `peerDependencies` will be treated as an install failure, even if npm could reasonably guess the appropriate resolution based on non-peer dependency relationships.
1087
1088 By default, conflicting `peerDependencies` deep in the dependency graph will be resolved using the nearest non-peer dependency specification, even if doing so will result in some packages receiving a peer dependency outside the range set in their package's `peerDependencies` object.
1089
1090 When such and override is performed, a warning is printed, explaining the conflict and the packages involved. If `--strict-peer-deps` is set, then this warning is treated as a failure.
1091
1092 #### `strict-ssl`
1093
1094 - Default: true
1095 - Type: Boolean
1096
1097 Whether or not to do SSL key validation when making requests to the registry via https.
1098
1099 See also the `ca` config.
1100
1101 #### `tag`
1102
1103 - Default: "latest"
1104 - Type: String
1105
1106 If you ask npm to install a package and don't tell it a specific version, then it will install the specified tag.
1107
1108 Also the tag that is added to the package@version specified by the `npm tag` command, if no explicit tag is given.
1109
1110 When used by the `npm diff` command, this is the tag used to fetch the tarball that will be compared with the local files by default.
1111
1112 #### `tag-version-prefix`
1113
1114 - Default: "v"
1115 - Type: String
1116
1117 If set, alters the prefix used when tagging a new version when performing a version increment using `npm-version`. To remove the prefix altogether, set it to the empty string: `""`.
1118
1119 Because other tools may rely on the convention that npm version tags look like `v1.0.0`, _only use this property if it is absolutely necessary_. In particular, use care when overriding this setting for public packages.
1120
1121 #### `timing`
1122
1123 - Default: false
1124 - Type: Boolean
1125
1126 If true, writes a debug log to `logs-dir` and timing information to `_timing.json` in the cache, even if the command completes successfully. `_timing.json` is a newline delimited list of JSON objects.
1127
1128 You can quickly view it with this [json](https://npm.im/json) command line: `npm exec -- json -g < ~/.npm/_timing.json`.
1129
1130 #### `umask`
1131
1132 - Default: 0
1133 - Type: Octal numeric string in range 0000..0777 (0..511)
1134
1135 The "umask" value to use when setting the file creation mode on files and folders.
1136
1137 Folders and executables are given a mode which is `0o777` masked against this value. Other files are given a mode which is `0o666` masked against this value.
1138
1139 Note that the underlying system will _also_ apply its own umask value to files and folders that are created, and npm does not circumvent this, but rather adds the `--umask` config to it.
1140
1141 Thus, the effective default umask value on most POSIX systems is 0o22, meaning that folders and executables are created with a mode of 0o755 and other files are created with a mode of 0o644.
1142
1143 #### `unicode`
1144
1145 - Default: false on windows, true on mac/unix systems with a unicode locale, as defined by the `LC_ALL`, `LC_CTYPE`, or `LANG` environment variables.
1146 - Type: Boolean
1147
1148 When set to true, npm uses unicode characters in the tree output. When false, it uses ascii characters instead of unicode glyphs.
1149
1150 #### `update-notifier`
1151
1152 - Default: true
1153 - Type: Boolean
1154
1155 Set to false to suppress the update notification when using an older version of npm than the latest.
1156
1157 #### `usage`
1158
1159 - Default: false
1160 - Type: Boolean
1161
1162 Show short usage output about the command specified.
1163
1164 #### `user-agent`
1165
1166 - Default: "npm/\{npm-version\} node/\{node-version\} \{platform\} \{arch\} workspaces/\{workspaces\} \{ci\}"
1167 - Type: String
1168
1169 Sets the User-Agent request header. The following fields are replaced with their actual counterparts:
1170
1171 - `{npm-version}` - The npm version in use
1172 - `{node-version}` - The Node.js version in use
1173 - `{platform}` - The value of `process.platform`
1174 - `{arch}` - The value of `process.arch`
1175 - `{workspaces}` - Set to `true` if the `workspaces` or `workspace` options are set.
1176 - `{ci}` - The value of the `ci-name` config, if set, prefixed with `ci/`, or an empty string if `ci-name` is empty.
1177
1178 #### `userconfig`
1179
1180 - Default: "~/.npmrc"
1181 - Type: Path
1182
1183 The location of user-level configuration settings.
1184
1185 This may be overridden by the `npm_config_userconfig` environment variable or the `--userconfig` command line option, but may _not_ be overridden by settings in the `globalconfig` file.
1186
1187 #### `version`
1188
1189 - Default: false
1190 - Type: Boolean
1191
1192 If true, output the npm version and exit successfully.
1193
1194 Only relevant when specified explicitly on the command line.
1195
1196 #### `versions`
1197
1198 - Default: false
1199 - Type: Boolean
1200
1201 If true, output the npm version as well as node's `process.versions` map and the version in the current working directory's `package.json` file if one exists, and exit successfully.
1202
1203 Only relevant when specified explicitly on the command line.
1204
1205 #### `viewer`
1206
1207 - Default: "man" on Posix, "browser" on Windows
1208 - Type: String
1209
1210 The program to use to view help content.
1211
1212 Set to `"browser"` to view html help content in the default web browser.
1213
1214 #### `which`
1215
1216 - Default: null
1217 - Type: null or Number
1218
1219 If there are multiple funding sources, which 1-indexed source URL to open.
1220
1221 #### `workspace`
1222
1223 - Default:
1224 - Type: String (can be set multiple times)
1225
1226 Enable running a command in the context of the configured workspaces of the current project while filtering by running only the workspaces defined by this configuration option.
1227
1228 Valid values for the `workspace` config are either:
1229
1230 - Workspace names
1231 - Path to a workspace directory
1232 - Path to a parent workspace directory (will result in selecting all workspaces within that folder)
1233
1234 When set for the `npm init` command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a brand new workspace within the project.
1235
1236 This value is not exported to the environment for child processes.
1237
1238 #### `workspaces`
1239
1240 - Default: null
1241 - Type: null or Boolean
1242
1243 Set to true to run the command in the context of **all** configured workspaces.
1244
1245 Explicitly setting this to false will cause commands like `install` to ignore workspaces altogether. When not set explicitly:
1246
1247 - Commands that operate on the `node_modules` tree (install, update, etc.) will link workspaces into the `node_modules` folder. - Commands that do other things (test, exec, publish, etc.) will operate on the root project, _unless_ one or more workspaces are specified in the `workspace` config.
1248
1249 This value is not exported to the environment for child processes.
1250
1251 #### `workspaces-update`
1252
1253 - Default: true
1254 - Type: Boolean
1255
1256 If set to true, the npm cli will run an update after operations that may possibly change the workspaces installed to the `node_modules` folder.
1257
1258 #### `yes`
1259
1260 - Default: null
1261 - Type: null or Boolean
1262
1263 Automatically answer "yes" to any prompts that npm might print on the command line.
1264
1265 #### `also`
1266
1267 - Default: null
1268 - Type: null, "dev", or "development"
1269 - DEPRECATED: Please use --include=dev instead.
1270
1271 When set to `dev` or `development`, this is an alias for `--include=dev`.
1272
1273 #### `cache-max`
1274
1275 - Default: Infinity
1276 - Type: Number
1277 - DEPRECATED: This option has been deprecated in favor of `--prefer-online`
1278
1279 `--cache-max=0` is an alias for `--prefer-online`
1280
1281 #### `cache-min`
1282
1283 - Default: 0
1284 - Type: Number
1285 - DEPRECATED: This option has been deprecated in favor of `--prefer-offline`.
1286
1287 `--cache-min=9999 (or bigger)` is an alias for `--prefer-offline`.
1288
1289 #### `dev`
1290
1291 - Default: false
1292 - Type: Boolean
1293 - DEPRECATED: Please use --include=dev instead.
1294
1295 Alias for `--include=dev`.
1296
1297 #### `init.author.email`
1298
1299 - Default: ""
1300 - Type: String
1301 - DEPRECATED: Use `--init-author-email` instead.
1302
1303 Alias for `--init-author-email`
1304
1305 #### `init.author.name`
1306
1307 - Default: ""
1308 - Type: String
1309 - DEPRECATED: Use `--init-author-name` instead.
1310
1311 Alias for `--init-author-name`
1312
1313 #### `init.author.url`
1314
1315 - Default: ""
1316 - Type: "" or URL
1317 - DEPRECATED: Use `--init-author-url` instead.
1318
1319 Alias for `--init-author-url`
1320
1321 #### `init.license`
1322
1323 - Default: "ISC"
1324 - Type: String
1325 - DEPRECATED: Use `--init-license` instead.
1326
1327 Alias for `--init-license`
1328
1329 #### `init.module`
1330
1331 - Default: "~/.npm-init.js"
1332 - Type: Path
1333 - DEPRECATED: Use `--init-module` instead.
1334
1335 Alias for `--init-module`
1336
1337 #### `init.version`
1338
1339 - Default: "1.0.0"
1340 - Type: SemVer string
1341 - DEPRECATED: Use `--init-version` instead.
1342
1343 Alias for `--init-version`
1344
1345 #### `only`
1346
1347 - Default: null
1348 - Type: null, "prod", or "production"
1349 - DEPRECATED: Use `--omit=dev` to omit dev dependencies from the install.
1350
1351 When set to `prod` or `production`, this is an alias for `--omit=dev`.
1352
1353 #### `optional`
1354
1355 - Default: null
1356 - Type: null or Boolean
1357 - DEPRECATED: Use `--omit=optional` to exclude optional dependencies, or `--include=optional` to include them.
1358
1359 Default value does install optional deps unless otherwise omitted.
1360
1361 Alias for --include=optional or --omit=optional
1362
1363 #### `production`
1364
1365 - Default: null
1366 - Type: null or Boolean
1367 - DEPRECATED: Use `--omit=dev` instead.
1368
1369 Alias for `--omit=dev`
1370
1371 #### `shrinkwrap`
1372
1373 - Default: true
1374 - Type: Boolean
1375 - DEPRECATED: Use the --package-lock setting instead.
1376
1377 Alias for --package-lock
1378
1379 #### `sso-poll-frequency`
1380
1381 - Default: 500
1382 - Type: Number
1383 - DEPRECATED: The --auth-type method of SSO/SAML/OAuth will be removed in a future version of npm in favor of web-based login.
1384
1385 When used with SSO-enabled `auth-type`s, configures how regularly the registry should be polled while the user is completing authentication.
1386
1387 #### `sso-type`
1388
1389 - Default: "oauth"
1390 - Type: null, "oauth", or "saml"
1391 - DEPRECATED: The --auth-type method of SSO/SAML/OAuth will be removed in a future version of npm in favor of web-based login.
1392
1393 If `--auth-type=sso`, the type of SSO type to use.
1394
1395 #### `tmp`
1396
1397 - Default: The value returned by the Node.js `os.tmpdir()` method [https://nodejs.org/api/os.html#os_os_tmpdir](https://nodejs.org/api/os.html#os_os_tmpdir)
1398 - Type: Path
1399 - DEPRECATED: This setting is no longer used. npm stores temporary files in a special location in the cache, and they are managed by [`cacache`](http://npm.im/cacache).
1400
1401 Historically, the location where temporary files were stored. No longer relevant.
1402
1403 ### See also
1404
1405 - [npm config](/cli/v8/commands/npm-config)
1406 - [npmrc](/cli/v8/configuring-npm/npmrc)
1407 - [npm scripts](/cli/v8/using-npm/scripts)
1408 - [npm folders](/cli/v8/configuring-npm/folders)
1409 - [npm](/cli/v8/commands/npm)