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