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