1 npm-config(7) -- More than you probably want to know about npm configuration
2 ============================================================================
6 npm gets its configuration values from 6 sources, in this priority:
10 Putting `--foo bar` on the command line sets the `foo` configuration
11 parameter to `"bar"`. A `--` argument tells the cli parser to stop
12 reading flags. A `--flag` parameter that is at the *end* of the
13 command will be given the value of `true`.
15 ### Environment Variables
17 Any environment variables that start with `npm_config_` will be
18 interpreted as a configuration parameter. For example, putting
19 `npm_config_foo=bar` in your environment will set the `foo`
20 configuration parameter to `bar`. Any environment configurations that
21 are not given a value will be given the value of `true`. Config
22 values are case-insensitive, so `NPM_CONFIG_FOO=bar` will work the
27 The three relevant files are:
29 * per-user config file (~/.npmrc)
30 * global config file ($PREFIX/npmrc)
31 * npm builtin config file (/path/to/npm/npmrc)
33 See npmrc(5) for more details.
37 A set of configuration parameters that are internal to npm, and are
38 defaults if nothing else is specified.
40 ## Shorthands and Other CLI Niceties
42 The following shorthands are parsed on the command-line:
45 * `-h`, `-?`, `--help`, `-H`: `--usage`
46 * `-s`, `--silent`: `--loglevel silent`
47 * `-q`, `--quiet`: `--loglevel warn`
48 * `-d`: `--loglevel info`
49 * `-dd`, `--verbose`: `--loglevel verbose`
50 * `-ddd`: `--loglevel silly`
54 * `-p`, `--porcelain`: `--parseable`
55 * `-reg`: `--registry`
58 * `-desc`: `--description`
61 * `-O`: `--save-optional`
62 * `-B`: `--save-bundle`
65 * `ll` and `la` commands: `ls --long`
67 If the specified configuration param resolves unambiguously to a known
68 configuration parameter, then it is expanded to that configuration
69 parameter. For example:
75 If multiple single-character shorthands are strung together, and the
76 resulting combination is unambiguously not some other configuration
77 param, then it is expanded to its various component pieces. For
82 npm ls --global --parseable --long --loglevel info
84 ## Per-Package Config Settings
86 When running scripts (see `npm-scripts(7)`) the package.json "config"
87 keys are overwritten in the environment if there is a config param of
88 `<name>[@<version>]:<key>`. For example, if the package.json has
92 , "config" : { "port" : "8080" }
93 , "scripts" : { "start" : "node server.js" } }
95 and the server.js is this:
97 http.createServer(...).listen(process.env.npm_package_config_port)
99 then the user could change the behavior by doing:
101 npm config set foo:port 80
103 See package.json(5) for more information.
112 Force npm to always require authentication when accessing the registry,
113 even for `GET` requests.
120 Tells npm to create symlinks (or `.cmd` shims on Windows) for package
123 Set to false to have it not do this. This can be used to work around
124 the fact that some file systems don't support symlinks, even on
125 ostensibly Unix systems.
129 * Default: OS X: `"open"`, Windows: `"start"`, Others: `"xdg-open"`
132 The browser that is called by the `npm docs` command to open websites.
136 * Default: The npm CA certificate
137 * Type: String or null
139 The Certificate Authority signing certificate that is trusted for SSL
140 connections to the registry.
142 Set to `null` to only allow "known" registrars, or to a specific CA cert
143 to trust only that specific signing authority.
145 See also the `strict-ssl` config.
149 * Default: Windows: `%AppData%\npm-cache`, Posix: `~/.npm`
152 The location of npm's cache directory. See `npm-cache(1)`
156 * Default: 60000 (1 minute)
159 The number of ms before cache folder lockfiles are considered stale.
161 ### cache-lock-retries
166 Number of times to retry to acquire a lock on cache folder lockfiles.
170 * Default: 10000 (10 seconds)
173 Number of ms to wait for cache lock files to expire.
180 The maximum time (in seconds) to keep items in the registry cache before
181 re-checking against the registry.
183 Note that no purging is done unless the `npm cache clean` command is
184 explicitly used, and that only GET requests use the cache.
191 The minimum time (in seconds) to keep items in the registry cache before
192 re-checking against the registry.
194 Note that no purging is done unless the `npm cache clean` command is
195 explicitly used, and that only GET requests use the cache.
199 * Default: true on Posix, false on Windows
200 * Type: Boolean or `"always"`
202 If false, never shows colors. If `"always"` then always shows colors.
203 If true, then only prints color codes for tty file descriptors.
210 A flag to tell test-harness to run with their coverage options enabled,
211 if they respond to the `npm_config_coverage` environment variable.
218 The depth to go when recursing directories for `npm ls` and
226 Show the description in `npm search`
233 Install `dev-dependencies` along with packages.
235 Note that `dev-dependencies` are also installed if the `npat` flag is
240 * Default: `EDITOR` environment variable if set, or `"vi"` on Posix,
241 or `"notepad"` on Windows.
244 The command to run for `npm edit` or `npm config edit`.
251 If set to true, then npm will stubbornly refuse to install (or even
252 consider installing) any package that claims to not be compatible with
253 the current Node.js version.
260 Makes various commands more forceful.
262 * lifecycle script failure does not block progress.
263 * publishing clobbers previously published versions.
264 * skips cache when requesting from the registry.
265 * prevents checks against clobbering non-npm files.
272 The "retries" config for the `retry` module to use when fetching
273 packages from the registry.
275 ### fetch-retry-factor
280 The "factor" config for the `retry` module to use when fetching
283 ### fetch-retry-mintimeout
285 * Default: 10000 (10 seconds)
288 The "minTimeout" config for the `retry` module to use when fetching
291 ### fetch-retry-maxtimeout
293 * Default: 60000 (1 minute)
296 The "maxTimeout" config for the `retry` module to use when fetching
304 The command to use for git commands. If git is installed on the
305 computer, but is not in the `PATH`, then set this to the full path to
313 Operates in "global" mode, so that packages are installed into the
314 `prefix` folder instead of the current working directory. See
315 `npm-folders(5)` for more on the differences in behavior.
317 * packages are installed into the `{prefix}/lib/node_modules` folder, instead of the
318 current working directory.
319 * bin files are linked to `{prefix}/bin`
320 * man pages are linked to `{prefix}/share/man`
324 * Default: {prefix}/etc/npmrc
327 The config file to read for global config options.
331 * Default: {prefix}/etc/npmignore
334 The config file to read for global ignore patterns to apply to all users
337 If not found, but there is a "gitignore" file in the
338 same directory, then that will be used instead.
342 * Default: GID of the current process
343 * Type: String or Number
345 The group to use when running package scripts in global mode as the root
350 * Default: the `HTTPS_PROXY` or `https_proxy` or `HTTP_PROXY` or
351 `http_proxy` environment variables.
354 A proxy to use for outgoing https requests.
358 * Default: node/{process.version} {process.platform} {process.arch}
361 Sets a User-Agent to the request header
368 A white-space separated list of glob patterns of files to always exclude
369 from packages when building tarballs.
373 * Default: ~/.npm-init.js
376 A module that will be loaded by the `npm init` command. See the
377 documentation for the
378 [init-package-json](https://github.com/isaacs/init-package-json) module
379 for more information, or npm-init(1).
386 The value `npm init` should use by default for the package version.
393 The value `npm init` should use by default for the package author's name.
395 ### init.author.email
400 The value `npm init` should use by default for the package author's email.
407 The value `npm init` should use by default for the package author's homepage.
411 * Default: "BSD-2-Clause"
414 The value `npm init` should use by default for the package license.
421 Whether or not to output JSON data, rather than the normal output.
423 This feature is currently experimental, and the output data structures
424 for many commands is either not implemented in JSON yet, or subject to
425 change. Only the output from `npm ls --json` is currently valid.
432 If true, then local installs will link if there is a suitable globally
435 Note that this means that local installs can cause things to be
436 installed into the global space at the same time. The link is only done
437 if one of the two conditions are met:
439 * The package is not already installed globally, or
440 * the globally installed version is identical to the version that is
441 being installed locally.
447 * Values: "silent", "win", "error", "warn", "http", "info", "verbose", "silly"
449 What level of logs to report. On failure, *all* logs are written to
450 `npm-debug.log` in the current working directory.
452 Any logs of a higher level than the setting are shown.
453 The default is "http", which shows http, warn, and error output.
457 * Default: process.stderr
460 This is the stream that is passed to the
461 [npmlog](https://github.com/isaacs/npmlog) module at run time.
463 It cannot be set from the command line, but if you are using npm
464 programmatically, you may wish to send logs to somewhere other than
467 If the `color` config is set to true, then this stream will receive
468 colored output if it is a TTY.
475 Show extended information in `npm ls`
482 Commit message which is used by `npm version` when creating version commit.
484 Any "%s" in the message will be replaced with the version number.
488 * Default: process.version
489 * Type: semver or false
491 The node version to use when checking package's "engines" hash.
498 Run tests on installation and report results to the
503 * Default: Not yet implemented
506 The url to report npat test results.
513 A node module to `require()` when npm loads. Useful for programmatic
521 Attempt to install packages in the `optionalDependencies` hash. Note
522 that if these packages fail to install, the overall installation
523 process is not aborted.
530 Output parseable results from commands that write to
535 * Default: see npm-folders(5)
538 The location to install global items. If set on the command line, then
539 it forces non-global commands to run in the specified folder.
546 Set to true to run in "production" mode.
548 1. devDependencies are not installed at the topmost level when running
549 local `npm install` without any arguments.
550 2. Set the NODE_ENV="production" for lifecycle scripts.
552 ### proprietary-attribs
557 Whether or not to include proprietary extended attributes in the
558 tarballs created by npm.
560 Unless you are expecting to unpack package tarballs with something other
561 than npm -- particularly a very outdated tar implementation -- leave
566 * Default: `HTTP_PROXY` or `http_proxy` environment variable, or null
569 A proxy to use for outgoing http requests.
576 Rebuild bundled dependencies after installation.
580 * Default: https://registry.npmjs.org/
583 The base URL of the npm package registry.
590 Remove failed installs.
597 Save installed packages to a package.json file as dependencies.
599 When used with the `npm rm` command, it removes it from the dependencies
602 Only works if there is already a package.json file present.
609 If a package would be saved at install time by the use of `--save`,
610 `--save-dev`, or `--save-optional`, then also put it in the
611 `bundleDependencies` list.
613 When used with the `npm rm` command, it removes it from the
614 bundledDependencies list.
621 Save installed packages to a package.json file as devDependencies.
623 When used with the `npm rm` command, it removes it from the devDependencies
626 Only works if there is already a package.json file present.
633 Save installed packages to a package.json file as optionalDependencies.
635 When used with the `npm rm` command, it removes it from the devDependencies
638 Only works if there is already a package.json file present.
645 Space-separated options that are always passed to search.
652 Space-separated options that limit the results from search.
658 * Values: "name", "-name", "date", "-date", "description",
659 "-description", "keywords", "-keywords"
661 Indication of which field to sort search results by. Prefix with a `-`
662 character to indicate reverse sort.
666 * Default: SHELL environment variable, or "bash" on Posix, or "cmd" on
670 The shell to run for the `npm explore` command.
677 If set to false, then ignore `npm-shrinkwrap.json` files when
685 If set to true, then the `npm version` command will tag the version
686 using `-s` to add a signature.
688 Note that git requires you to have set up GPG keys in your git configs
689 for this to work properly.
696 Whether or not to do SSL key validation when making requests to the
699 See also the `ca` config.
706 If you ask npm to install a package and don't tell it a specific version, then
707 it will install the specified tag.
709 Also the tag that is added to the package@version specified by the `npm
710 tag` command, if no explicit tag is given.
714 * Default: TMPDIR environment variable, or "/tmp"
717 Where to store temporary files and folders. All temp files are deleted
718 on success, but left behind on failure for forensic purposes.
725 When set to true, npm uses unicode characters in the tree output. When
726 false, it uses ascii characters to draw trees.
730 * Default: false if running as root, true otherwise
733 Set to true to suppress the UID/GID switching when running package
734 scripts. If set explicitly to false, then installing as a non-root user
742 Set to show short usage output (like the -H output)
743 instead of complete help when doing `npm-help(1)`.
748 * Type: String or Number
750 The UID to set to when running package scripts as root.
757 The username on the npm registry. Set with `npm adduser`
764 The location of user-level configuration settings.
768 * Default: ~/.npmignore
771 The location of a user-level ignore file to apply to all packages.
773 If not found, but there is a .gitignore file in the same directory, then
774 that will be used instead.
779 * Type: Octal numeric string
781 The "umask" value to use when setting the file creation mode on files
784 Folders and executables are given a mode which is `0777` masked against
785 this value. Other files are given a mode which is `0666` masked against
786 this value. Thus, the defaults are `0755` and `0644` respectively.
793 If true, output the npm version and exit successfully.
795 Only relevant when specified explicitly on the command line.
802 If true, output the npm version as well as node's `process.versions`
803 hash, and exit successfully.
805 Only relevant when specified explicitly on the command line.
809 * Default: "man" on Posix, "browser" on Windows
812 The program to use to view help content.
814 Set to `"browser"` to view html help content in the default web browser.
819 * Type: Boolean or null
821 If set to `null`, then prompt the user for responses in some
824 If set to `true`, then answer "yes" to any prompt. If set to `false`
825 then answer "no" to any prompt.