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