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