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