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