1 ---
2 title: config
3 section: 7
4 description: More than you probably want to know about npm configuration
5 github_repo: npm/cli
6 github_branch: release/v6
7 github_path: docs/content/using-npm/config.md
8 redirect_from:
9 - /cli-documentation/v6/misc/config
10 - /cli-documentation/v6/using-npm/config
11 - /cli/v6/misc/config
12 ---
13
14 ### Description
15
16 npm gets its configuration values from the following sources, sorted by priority:
17
18 #### Command Line Flags
19
20 Putting `--foo bar` on the command line sets the `foo` configuration parameter to `"bar"`. A `--` argument tells the cli parser to stop reading flags. Using `--flag` without specifying any value will set the value to `true`.
21
22 Example: `--flag1 --flag2` will set both configuration parameters to `true`, while `--flag1 --flag2 bar` will set `flag1` to `true`, and `flag2` to `bar`. Finally, `--flag1 --flag2 -- bar` will set both configuration parameters to `true`, and the `bar` is taken as a command argument.
23
24 #### Environment Variables
25
26 Any environment variables that start with `npm_config_` will be interpreted as a configuration parameter. For example, putting `npm_config_foo=bar` in your environment will set the `foo` configuration parameter to `bar`. Any environment configurations that are not given a value will be given the value of `true`. Config values are case-insensitive, so `NPM_CONFIG_FOO=bar` will work the same. However, please note that inside [`scripts`](/cli/v6/using-npm/scripts) npm will set its own environment variables and Node will prefer those lowercase versions over any uppercase ones that you might set. For details see [this issue](https://github.com/npm/npm/issues/14528).
27
28 Notice that you need to use underscores instead of dashes, so `--allow-same-version` would become `npm_config_allow_same_version=true`.
29
30 #### npmrc Files
31
32 The four relevant files are:
33
34 - per-project configuration file (`/path/to/my/project/.npmrc`)
35 - per-user configuration file (defaults to `$HOME/.npmrc`; configurable via CLI option `--userconfig` or environment variable `$NPM_CONFIG_USERCONFIG`)
36 - global configuration file (defaults to `$PREFIX/etc/npmrc`; configurable via CLI option `--globalconfig` or environment variable `$NPM_CONFIG_GLOBALCONFIG`)
37 - npm's built-in configuration file (`/path/to/npm/npmrc`)
38
39 See [npmrc](/cli/v6/configuring-npm/npmrc) for more details.
40
41 #### Default Configs
42
43 Run `npm config ls -l` to see a set of configuration parameters that are internal to npm, and are defaults if nothing else is specified.
44
45 ### Shorthands and Other CLI Niceties
46
47 The following shorthands are parsed on the command-line:
48
49 - `-v`: `--version`
50 - `-h`, `-?`, `--help`, `-H`: `--usage`
51 - `-s`, `--silent`: `--loglevel silent`
52 - `-q`, `--quiet`: `--loglevel warn`
53 - `-d`: `--loglevel info`
54 - `-dd`, `--verbose`: `--loglevel verbose`
55 - `-ddd`: `--loglevel silly`
56 - `-g`: `--global`
57 - `-C`: `--prefix`
58 - `-l`: `--long`
59 - `-m`: `--message`
60 - `-p`, `--porcelain`: `--parseable`
61 - `-reg`: `--registry`
62 - `-f`: `--force`
63 - `-desc`: `--description`
64 - `-S`: `--save`
65 - `-P`: `--save-prod`
66 - `-D`: `--save-dev`
67 - `-O`: `--save-optional`
68 - `-B`: `--save-bundle`
69 - `-E`: `--save-exact`
70 - `-y`: `--yes`
71 - `-n`: `--yes false`
72 - `ll` and `la` commands: `ls --long`
73
74 If the specified configuration param resolves unambiguously to a known configuration parameter, then it is expanded to that configuration parameter. For example:
75
76 ```bash
77 npm ls --par
78 # same as:
79 npm ls --parseable
80 ```
81
82 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:
83
84 ```bash
85 npm ls -gpld
86 # same as:
87 npm ls --global --parseable --long --loglevel info
88 ```
89
90 ### Per-Package Config Settings
91
92 When running scripts (see [`scripts`](/cli/v6/using-npm/scripts)) the package.json "config" keys are overwritten in the environment if there is a config param of `<name>[@<version>]:<key>`. For example, if the package.json has this:
93
94 ```json
95 {
96 "name": "foo",
97 "config": { "port": "8080" },
98 "scripts": { "start": "node server.js" }
99 }
100 ```
101
102 and the server.js is this:
103
104 ```javascript
105 http.createServer(...).listen(process.env.npm_package_config_port)
106 ```
107
108 then the user could change the behavior by doing:
109
110 ```bash
111 npm config set foo:port 80
112 ```
113
114 See [package.json](/cli/v6/configuring-npm/package-json) for more information.
115
116 ### Config Settings
117
118 #### access
119
120 - Default: `restricted`
121 - Type: Access
122
123 When publishing scoped packages, the access level defaults to `restricted`. If you want your scoped package to be publicly viewable (and installable) set `--access=public`. The only valid values for `access` are `public` and `restricted`. Unscoped packages _always_ have an access level of `public`.
124
125 #### allow-same-version
126
127 - Default: false
128 - Type: Boolean
129
130 Prevents throwing an error when `npm version` is used to set the new version to the same value as the current version.
131
132 #### always-auth
133
134 - Default: false
135 - Type: Boolean
136
137 Force npm to always require authentication when accessing the registry, even for `GET` requests.
138
139 #### also
140
141 - Default: null
142 - Type: String
143
144 When "dev" or "development" and running local `npm shrinkwrap`, `npm outdated`, or `npm update`, is an alias for `--dev`.
145
146 #### audit
147
148 - Default: true
149 - Type: Boolean
150
151 When "true" submit audit reports alongside `npm install` runs to the default registry and all registries configured for scopes. See the documentation for [`npm audit`](/cli/v6/commands/npm-audit) for details on what is submitted.
152
153 #### audit-level
154
155 - Default: `"low"`
156 - Type: `'low'`, `'moderate'`, `'high'`, `'critical'`
157
158 The minimum level of vulnerability for `npm audit` to exit with a non-zero exit code.
159
160 #### auth-type
161
162 - Default: `'legacy'`
163 - Type: `'legacy'`, `'sso'`, `'saml'`, `'oauth'`
164
165 What authentication strategy to use with `adduser`/`login`.
166
167 #### before
168
169 - Alias: enjoy-by
170 - Default: null
171 - Type: Date
172
173 If passed to `npm install`, will rebuild the npm tree such that only versions that were available **on or before** the `--before` time get installed. If there's no versions available for the current set of direct dependencies, the command will error.
174
175 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`.
176
177 #### bin-links
178
179 - Default: `true`
180 - Type: Boolean
181
182 Tells npm to create symlinks (or `.cmd` shims on Windows) for package executables.
183
184 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.
185
186 #### browser
187
188 - Default: OS X: `"open"`, Windows: `"start"`, Others: `"xdg-open"`
189 - Type: String
190
191 The browser that is called by the `npm docs` command to open websites.
192
193 #### ca
194
195 - Default: The npm CA certificate
196 - Type: String, Array or null
197
198 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:
199
200 ```bash
201 ca="-----BEGIN CERTIFICATE-----\nXXXX\nXXXX\n-----END CERTIFICATE-----"
202 ```
203
204 Set to `null` to only allow "known" registrars, or to a specific CA cert to trust only that specific signing authority.
205
206 Multiple CAs can be trusted by specifying an array of certificates:
207
208 ```bash
209 ca[]="..."
210 ca[]="..."
211 ```
212
213 See also the `strict-ssl` config.
214
215 #### cafile
216
217 - Default: `null`
218 - Type: path
219
220 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.
221
222 #### cache
223
224 - Default: Windows: `%AppData%\npm-cache`, Posix: `~/.npm`
225 - Type: path
226
227 The location of npm's cache directory. See [`npm cache`](/cli/v6/commands/npm-cache)
228
229 #### cache-lock-stale
230
231 - Default: 60000 (1 minute)
232 - Type: Number
233
234 The number of ms before cache folder lockfiles are considered stale.
235
236 #### cache-lock-retries
237
238 - Default: 10
239 - Type: Number
240
241 Number of times to retry to acquire a lock on cache folder lockfiles.
242
243 #### cache-lock-wait
244
245 - Default: 10000 (10 seconds)
246 - Type: Number
247
248 Number of ms to wait for cache lock files to expire.
249
250 #### cache-max
251
252 - Default: Infinity
253 - Type: Number
254
255 **DEPRECATED**: This option has been deprecated in favor of `--prefer-online`.
256
257 `--cache-max=0` is an alias for `--prefer-online`.
258
259 #### cache-min
260
261 - Default: 10
262 - Type: Number
263
264 **DEPRECATED**: This option has been deprecated in favor of `--prefer-offline`.
265
266 `--cache-min=9999 (or bigger)` is an alias for `--prefer-offline`.
267
268 #### cert
269
270 - Default: `null`
271 - Type: String
272
273 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:
274
275 ```bash
276 cert="-----BEGIN CERTIFICATE-----\nXXXX\nXXXX\n-----END CERTIFICATE-----"
277 ```
278
279 It is _not_ the path to a certificate file (and there is no "certfile" option).
280
281 #### cidr
282
283 - Default: `null`
284 - Type: String, Array, null
285
286 This is a list of CIDR address to be used when configuring limited access tokens with the `npm token create` command.
287
288 #### color
289
290 - Default: true
291 - Type: Boolean or `"always"`
292
293 If false, never shows colors. If `"always"` then always shows colors. If true, then only prints color codes for tty file descriptors.
294
295 This option can also be changed using the environment: colors are disabled when the environment variable `NO_COLOR` is set to any value.
296
297 #### depth
298
299 - Default: Infinity
300 - Type: Number
301
302 The depth to go when recursing directories for `npm ls`, `npm cache ls`, and `npm outdated`.
303
304 For `npm outdated`, a setting of `Infinity` will be treated as `0` since that gives more useful information. To show the outdated status of all packages and dependents, use a large integer value, e.g., `npm outdated --depth 9999`
305
306 #### description
307
308 - Default: true
309 - Type: Boolean
310
311 Show the description in `npm search`
312
313 #### dev
314
315 - Default: false
316 - Type: Boolean
317
318 Install `dev-dependencies` along with packages.
319
320 #### dry-run
321
322 - Default: false
323 - Type: Boolean
324
325 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`. This is NOT currently honored by some network related commands, eg `dist-tags`, `owner`, etc.
326
327 #### editor
328
329 - Default: `EDITOR` environment variable if set, or `"vi"` on Posix, or `"notepad"` on Windows.
330 - Type: path
331
332 The command to run for `npm edit` or `npm config edit`.
333
334 #### engine-strict
335
336 - Default: false
337 - Type: Boolean
338
339 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.
340
341 #### force
342
343 - Default: false
344 - Type: Boolean
345
346 Makes various commands more forceful.
347
348 - lifecycle script failure does not block progress.
349 - publishing clobbers previously published versions.
350 - skips cache when requesting from the registry.
351 - prevents checks against clobbering non-npm files.
352
353 #### format-package-lock
354
355 - Default: true
356 - Type: Boolean
357
358 Format `package-lock.json` or `npm-shrinkwrap.json` as a human readable file.
359
360 #### fetch-retries
361
362 - Default: 2
363 - Type: Number
364
365 The "retries" config for the `retry` module to use when fetching packages from the registry.
366
367 #### fetch-retry-factor
368
369 - Default: 10
370 - Type: Number
371
372 The "factor" config for the `retry` module to use when fetching packages.
373
374 #### fetch-retry-mintimeout
375
376 - Default: 10000 (10 seconds)
377 - Type: Number
378
379 The "minTimeout" config for the `retry` module to use when fetching packages.
380
381 #### fetch-retry-maxtimeout
382
383 - Default: 60000 (1 minute)
384 - Type: Number
385
386 The "maxTimeout" config for the `retry` module to use when fetching packages.
387
388 #### fund
389
390 - Default: true
391 - Type: Boolean
392
393 When "true" displays the message at the end of each `npm install` acknowledging the number of dependencies looking for funding. See [`npm fund`](/cli/v6/commands/npm-fund) for details.
394
395 #### git
396
397 - Default: `"git"`
398 - Type: String
399
400 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.
401
402 #### git-tag-version
403
404 - Default: `true`
405 - Type: Boolean
406
407 Tag the commit when using the `npm version` command.
408
409 #### commit-hooks
410
411 - Default: `true`
412 - Type: Boolean
413
414 Run git commit hooks when using the `npm version` command.
415
416 #### global
417
418 - Default: false
419 - Type: Boolean
420
421 Operates in "global" mode, so that packages are installed into the `prefix` folder instead of the current working directory. See [folders](/cli/v6/configuring-npm/folders) for more on the differences in behavior.
422
423 - packages are installed into the `{prefix}/lib/node_modules` folder, instead of the current working directory.
424 - bin files are linked to `{prefix}/bin`
425 - man pages are linked to `{prefix}/share/man`
426
427 #### globalconfig
428
429 - Default: \{prefix\}/etc/npmrc
430 - Type: path
431
432 The config file to read for global config options.
433
434 #### global-style
435
436 - Default: false
437 - Type: Boolean
438
439 Causes npm to install the package into your local `node_modules` folder with the same layout it uses with the global `node_modules` folder. Only your direct dependencies will show in `node_modules` and everything they depend on will be flattened in their `node_modules` folders. This obviously will eliminate some deduping. If used with `legacy-bundling`, `legacy-bundling` will be preferred.
440
441 #### group
442
443 - Default: GID of the current process
444 - Type: String or Number
445
446 The group to use when running package scripts in global mode as the root user.
447
448 #### heading
449
450 - Default: `"npm"`
451 - Type: String
452
453 The string that starts all the debugging log output.
454
455 #### https-proxy
456
457 - Default: null
458 - Type: url
459
460 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 `request` library.
461
462 #### if-present
463
464 - Default: false
465 - Type: Boolean
466
467 If true, npm will not exit with an error code when `run-script` is invoked for a script that isn't defined in the `scripts` section of `package.json`. This option can be used when it's desirable to optionally run a script when it's present and fail if the script fails. This is useful, for example, when running scripts that may only apply for some builds in an otherwise generic CI setup.
468
469 #### ignore-prepublish
470
471 - Default: false
472 - Type: Boolean
473
474 If true, npm will not run `prepublish` scripts.
475
476 #### ignore-scripts
477
478 - Default: false
479 - Type: Boolean
480
481 If true, npm does not run scripts specified in package.json files.
482
483 #### init-module
484
485 - Default: ~/.npm-init.js
486 - Type: path
487
488 A module that will be loaded by the `npm init` command. See the documentation for the [init-package-json](https://github.com/isaacs/init-package-json) module for more information, or [npm init](/cli/v6/commands/npm-init).
489
490 #### init-author-name
491
492 - Default: ""
493 - Type: String
494
495 The value `npm init` should use by default for the package author's name.
496
497 #### init-author-email
498
499 - Default: ""
500 - Type: String
501
502 The value `npm init` should use by default for the package author's email.
503
504 #### init-author-url
505
506 - Default: ""
507 - Type: String
508
509 The value `npm init` should use by default for the package author's homepage.
510
511 #### init-license
512
513 - Default: "ISC"
514 - Type: String
515
516 The value `npm init` should use by default for the package license.
517
518 #### init-version
519
520 - Default: "1.0.0"
521 - Type: semver
522
523 The value that `npm init` should use by default for the package version number, if not already set in package.json.
524
525 #### json
526
527 - Default: false
528 - Type: Boolean
529
530 Whether or not to output JSON data, rather than the normal output.
531
532 This feature is currently experimental, and the output data structures for many commands is either not implemented in JSON yet, or subject to change. Only the output from `npm ls --json` and `npm search --json` are currently valid.
533
534 #### key
535
536 - Default: `null`
537 - Type: String
538
539 A client key to pass when accessing the registry. Values should be in PEM format with newlines replaced by the string "\n". For example:
540
541 ```json
542 key="-----BEGIN PRIVATE KEY-----\nXXXX\nXXXX\n-----END PRIVATE KEY-----"
543 ```
544
545 It is _not_ the path to a key file (and there is no "keyfile" option).
546
547 #### legacy-bundling
548
549 - Default: false
550 - Type: Boolean
551
552 Causes npm to install the package such that versions of npm prior to 1.4, such as the one included with node 0.8, can install the package. This eliminates all automatic deduping. If used with `global-style` this option will be preferred.
553
554 #### link
555
556 - Default: false
557 - Type: Boolean
558
559 If true, then local installs will link if there is a suitable globally installed package.
560
561 Note that this means that local installs can cause things to be installed into the global space at the same time. The link is only done if one of the two conditions are met:
562
563 - The package is not already installed globally, or
564 - the globally installed version is identical to the version that is being installed locally.
565
566 #### local-address
567
568 - Default: undefined
569 - Type: IP Address
570
571 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.
572
573 #### loglevel
574
575 - Default: "notice"
576 - Type: String
577 - Values: "silent", "error", "warn", "notice", "http", "timing", "info", "verbose", "silly"
578
579 What level of logs to report. On failure, _all_ logs are written to `npm-debug.log` in the current working directory.
580
581 Any logs of a higher level than the setting are shown. The default is "notice".
582
583 #### logstream
584
585 - Default: process.stderr
586 - Type: Stream
587
588 This is the stream that is passed to the [npmlog](https://github.com/npm/npmlog) module at run time.
589
590 It cannot be set from the command line, but if you are using npm programmatically, you may wish to send logs to somewhere other than stderr.
591
592 If the `color` config is set to true, then this stream will receive colored output if it is a TTY.
593
594 #### logs-max
595
596 - Default: 10
597 - Type: Number
598
599 The maximum number of log files to store.
600
601 #### long
602
603 - Default: false
604 - Type: Boolean
605
606 Show extended information in `npm ls` and `npm search`.
607
608 #### maxsockets
609
610 - Default: 50
611 - Type: Number
612
613 The maximum number of connections to use per origin (protocol/host/port combination). Passed to the `http` `Agent` used to make the request.
614
615 #### message
616
617 - Default: "%s"
618 - Type: String
619
620 Commit message which is used by `npm version` when creating version commit.
621
622 Any "%s" in the message will be replaced with the version number.
623
624 #### metrics-registry
625
626 - Default: The value of `registry` (which defaults to "https://registry.npmjs.org/")
627 - Type: String
628
629 The registry you want to send cli metrics to if `send-metrics` is true.
630
631 #### node-options
632
633 - Default: null
634 - Type: String
635
636 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.
637
638 #### node-version
639
640 - Default: process.version
641 - Type: semver or false
642
643 The node version to use when checking a package's `engines` map.
644
645 #### noproxy
646
647 - Default: null
648 - Type: String or Array
649
650 A comma-separated string or an array of domain extensions that a proxy should not be used for.
651
652 #### offline
653
654 - Default: false
655 - Type: Boolean
656
657 Force offline mode: no network requests will be done during install. To allow the CLI to fill in missing cache data, see `--prefer-offline`.
658
659 #### onload-script
660
661 - Default: false
662 - Type: path
663
664 A node module to `require()` when npm loads. Useful for programmatic usage.
665
666 #### only
667
668 - Default: null
669 - Type: String
670
671 When "dev" or "development" and running local `npm install` without any arguments, only devDependencies (and their dependencies) are installed.
672
673 When "dev" or "development" and running local `npm ls`, `npm outdated`, or `npm update`, is an alias for `--dev`.
674
675 When "prod" or "production" and running local `npm install` without any arguments, only non-devDependencies (and their dependencies) are installed.
676
677 When "prod" or "production" and running local `npm ls`, `npm outdated`, or `npm update`, is an alias for `--production`.
678
679 #### optional
680
681 - Default: true
682 - Type: Boolean
683
684 Attempt to install packages in the `optionalDependencies` object. Note that if these packages fail to install, the overall installation process is not aborted.
685
686 #### otp
687
688 - Default: null
689 - Type: Number
690
691 This is a one-time password from a two-factor authenticator. It's needed when publishing or changing package permissions with `npm access`.
692
693 #### package-lock
694
695 - Default: true
696 - Type: Boolean
697
698 If set to false, then ignore `package-lock.json` files when installing. This will also prevent _writing_ `package-lock.json` if `save` is true.
699
700 When package package-locks are disabled, automatic pruning of extraneous modules will also be disabled. To remove extraneous modules with package-locks disabled use `npm prune`.
701
702 This option is an alias for `--shrinkwrap`.
703
704 #### package-lock-only
705
706 - Default: false
707 - Type: Boolean
708
709 If set to true, it will update only the `package-lock.json`, instead of checking `node_modules` and downloading dependencies.
710
711 #### parseable
712
713 - Default: false
714 - Type: Boolean
715
716 Output parseable results from commands that write to standard output. For `npm search`, this will be tab-separated table format.
717
718 #### prefer-offline
719
720 - Default: false
721 - Type: Boolean
722
723 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`.
724
725 This option is effectively equivalent to `--cache-min=9999999`.
726
727 #### prefer-online
728
729 - Default: false
730 - Type: Boolean
731
732 If true, staleness checks for cached data will be forced, making the CLI look for updates immediately even for fresh package data.
733
734 #### prefix
735
736 - Default: see [folders](/cli/v6/configuring-npm/folders)
737 - Type: path
738
739 The location to install global items. If set on the command line, then it forces non-global commands to run in the specified folder.
740
741 #### preid
742
743 - Default: ""
744 - Type: String
745
746 The "prerelease identifier" to use as a prefix for the "prerelease" part of a semver. Like the `rc` in `1.2.0-rc.8`.
747
748 #### production
749
750 - Default: false
751 - Type: Boolean
752
753 Set to true to run in "production" mode.
754
755 1. devDependencies are not installed at the topmost level when running local `npm install` without any arguments.
756 2. Set the NODE_ENV="production" for lifecycle scripts.
757
758 #### progress
759
760 - Default: true, unless TRAVIS or CI env vars set.
761 - Type: Boolean
762
763 When set to `true`, npm will display a progress bar during time intensive operations, if `process.stderr` is a TTY.
764
765 Set to `false` to suppress the progress bar.
766
767 #### proxy
768
769 - Default: null
770 - Type: url
771
772 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.
773
774 #### read-only
775
776 - Default: false
777 - Type: Boolean
778
779 This is used to mark a token as unable to publish when configuring limited access tokens with the `npm token create` command.
780
781 #### rebuild-bundle
782
783 - Default: true
784 - Type: Boolean
785
786 Rebuild bundled dependencies after installation.
787
788 #### registry
789
790 - Default: https://registry.npmjs.org/
791 - Type: url
792
793 The base URL of the npm package registry.
794
795 #### rollback
796
797 - Default: true
798 - Type: Boolean
799
800 Remove failed installs.
801
802 #### save
803
804 - Default: true
805 - Type: Boolean
806
807 Save installed packages to a package.json file as dependencies.
808
809 When used with the `npm rm` command, it removes it from the `dependencies` object.
810
811 Only works if there is already a package.json file present.
812
813 #### save-bundle
814
815 - Default: false
816 - Type: Boolean
817
818 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.
819
820 When used with the `npm rm` command, it removes it from the bundledDependencies list.
821
822 #### save-prod
823
824 - Default: false
825 - Type: Boolean
826
827 Makes sure that a package will be saved into `dependencies` specifically. This is useful if a package already exists in `devDependencies` or `optionalDependencies`, but you want to move it to be a production dep. This is also the default behavior if `--save` is true, and neither `--save-dev` or `--save-optional` are true.
828
829 #### save-dev
830
831 - Default: false
832 - Type: Boolean
833
834 Save installed packages to a package.json file as `devDependencies`.
835
836 When used with the `npm rm` command, it removes it from the `devDependencies` object.
837
838 Only works if there is already a package.json file present.
839
840 #### save-exact
841
842 - Default: false
843 - Type: Boolean
844
845 Dependencies saved to package.json using `--save`, `--save-dev` or `--save-optional` will be configured with an exact version rather than using npm's default semver range operator.
846
847 #### save-optional
848
849 - Default: false
850 - Type: Boolean
851
852 Save installed packages to a package.json file as optionalDependencies.
853
854 When used with the `npm rm` command, it removes it from the `devDependencies` object.
855
856 Only works if there is already a package.json file present.
857
858 #### save-prefix
859
860 - Default: '^'
861 - Type: String
862
863 Configure how versions of packages installed to a package.json file via `--save` or `--save-dev` get prefixed.
864
865 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.
866
867 #### scope
868
869 - Default: the scope of the current project, if any, or ""
870 - Type: String
871
872 Associate an operation with a scope for a scoped registry. Useful when logging in to a private registry for the first time: `npm login --scope=@organization --registry=registry.organization.com`, which will cause `@organization` to be mapped to the registry for future installation of packages specified according to the pattern `@organization/package`.
873
874 #### script-shell
875
876 - Default: `null`
877 - Type: path
878
879 The shell to use for scripts run with the `npm run` command.
880
881 #### scripts-prepend-node-path
882
883 - Default: "warn-only"
884 - Type: Boolean, `"auto"` or `"warn-only"`
885
886 If set to `true`, add the directory in which the current `node` executable resides to the `PATH` environment variable when running scripts, even if that means that `npm` will invoke a different `node` executable than the one which it is running.
887
888 If set to `false`, never modify `PATH` with that.
889
890 If set to `"warn-only"`, never modify `PATH` but print a warning if `npm` thinks that you may want to run it with `true`, e.g. because the `node` executable in the `PATH` is not the one `npm` was invoked with.
891
892 If set to `auto`, only add that directory to the `PATH` environment variable if the `node` executable with which `npm` was invoked and the one that is found first on the `PATH` are different.
893
894 #### searchexclude
895
896 - Default: ""
897 - Type: String
898
899 Space-separated options that limit the results from search.
900
901 #### searchopts
902
903 - Default: ""
904 - Type: String
905
906 Space-separated options that are always passed to search.
907
908 #### searchlimit
909
910 - Default: 20
911 - Type: Number
912
913 Number of items to limit search results to. Will not apply at all to legacy searches.
914
915 #### searchstaleness
916
917 - Default: 900 (15 minutes)
918 - Type: Number
919
920 The age of the cache, in seconds, before another registry request is made if using legacy search endpoint.
921
922 #### send-metrics
923
924 - Default: false
925 - Type: Boolean
926
927 If true, success/failure metrics will be reported to the registry stored in `metrics-registry`. These requests contain the number of successful and failing runs of the npm CLI and the time period overwhich those counts were gathered. No identifying information is included in these requests.
928
929 #### shell
930
931 - Default: SHELL environment variable, or "bash" on Posix, or "cmd" on Windows
932 - Type: path
933
934 The shell to run for the `npm explore` command.
935
936 #### shrinkwrap
937
938 - Default: true
939 - Type: Boolean
940
941 If set to false, then ignore `npm-shrinkwrap.json` files when installing. This will also prevent _writing_ `npm-shrinkwrap.json` if `save` is true.
942
943 This option is an alias for `--package-lock`.
944
945 #### sign-git-commit
946
947 - Default: false
948 - Type: Boolean
949
950 If set to true, then the `npm version` command will commit the new package version using `-S` to add a signature.
951
952 Note that git requires you to have set up GPG keys in your git configs for this to work properly.
953
954 #### sign-git-tag
955
956 - Default: false
957 - Type: Boolean
958
959 If set to true, then the `npm version` command will tag the version using `-s` to add a signature.
960
961 Note that git requires you to have set up GPG keys in your git configs for this to work properly.
962
963 #### sso-poll-frequency
964
965 - Default: 500
966 - Type: Number
967
968 When used with SSO-enabled `auth-type`s, configures how regularly the registry should be polled while the user is completing authentication.
969
970 #### sso-type
971
972 - Default: 'oauth'
973 - Type: 'oauth', 'saml', or null
974
975 If `--auth-type=sso`, the type of SSO type to use.
976
977 #### strict-ssl
978
979 - Default: true
980 - Type: Boolean
981
982 Whether or not to do SSL key validation when making requests to the registry via https.
983
984 See also the `ca` config.
985
986 #### tag
987
988 - Default: latest
989 - Type: String
990
991 If you ask npm to install a package and don't tell it a specific version, then it will install the specified tag.
992
993 Also the tag that is added to the package@version specified by the `npm tag` command, if no explicit tag is given.
994
995 #### tag-version-prefix
996
997 - Default: `"v"`
998 - Type: String
999
1000 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: `""`.
1001
1002 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.
1003
1004 #### timing
1005
1006 - Default: `false`
1007 - Type: Boolean
1008
1009 If true, writes an `npm-debug` log to `_logs` and timing information to `_timing.json`, both in your cache. `_timing.json` is a newline delimited list of JSON objects. You can quickly view it with this [json](https://www.npmjs.com/package/json) command line: `json -g < ~/.npm/_timing.json`.
1010
1011 #### tmp
1012
1013 - Default: TMPDIR environment variable, or "/tmp"
1014 - Type: path
1015
1016 Where to store temporary files and folders. All temp files are deleted on success, but left behind on failure for forensic purposes.
1017
1018 #### unicode
1019
1020 - Default: false on windows, true on mac/unix systems with a unicode locale
1021 - Type: Boolean
1022
1023 When set to true, npm uses unicode characters in the tree output. When false, it uses ascii characters to draw trees.
1024
1025 #### unsafe-perm
1026
1027 - Default: false if running as root, true otherwise
1028 - Type: Boolean
1029
1030 Set to true to suppress the UID/GID switching when running package scripts. If set explicitly to false, then installing as a non-root user will fail.
1031
1032 #### update-notifier
1033
1034 - Default: true
1035 - Type: Boolean
1036
1037 Set to false to suppress the update notification when using an older version of npm than the latest.
1038
1039 #### usage
1040
1041 - Default: false
1042 - Type: Boolean
1043
1044 Set to show short usage output (like the -H output) instead of complete help when doing [`npm help`](/cli/v6/commands/npm-help).
1045
1046 #### user
1047
1048 - Default: "nobody"
1049 - Type: String or Number
1050
1051 The UID to set to when running package scripts as root.
1052
1053 #### userconfig
1054
1055 - Default: ~/.npmrc
1056 - Type: path
1057
1058 The location of user-level configuration settings.
1059
1060 #### umask
1061
1062 - Default: 022
1063 - Type: Octal numeric string in range 0000..0777 (0..511)
1064
1065 The "umask" value to use when setting the file creation mode on files and folders.
1066
1067 Folders and executables are given a mode which is `0777` masked against this value. Other files are given a mode which is `0666` masked against this value. Thus, the defaults are `0755` and `0644` respectively.
1068
1069 #### user-agent
1070
1071 - Default: node/\{process.version\} \{process.platform\} \{process.arch\}
1072 - Type: String
1073
1074 Sets a User-Agent to the request header
1075
1076 #### version
1077
1078 - Default: false
1079 - Type: boolean
1080
1081 If true, output the npm version and exit successfully.
1082
1083 Only relevant when specified explicitly on the command line.
1084
1085 #### versions
1086
1087 - Default: false
1088 - Type: boolean
1089
1090 If true, output the npm version as well as node's `process.versions` map, and exit successfully.
1091
1092 Only relevant when specified explicitly on the command line.
1093
1094 #### viewer
1095
1096 - Default: "man" on Posix, "browser" on Windows
1097 - Type: path
1098
1099 The program to use to view help content.
1100
1101 Set to `"browser"` to view html help content in the default web browser.
1102
1103 ### See also
1104
1105 - [npm config](/cli/v6/commands/npm-config)
1106 - [npmrc](/cli/v6/configuring-npm/npmrc)
1107 - [npm scripts](/cli/v6/using-npm/scripts)
1108 - [npm folders](/cli/v6/configuring-npm/folders)
1109 - [npm](/cli/v6/commands/npm)