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