NPM-CONFIG(7)

πŸŽ€ NAME πŸŽ€

Config β€” the whole tea on npm configuration β˜•οΈπŸ’… (this is NPM-CONFIG(7), bestie, section 7 of the npm manual β€” say it with me, manual section seven, iconic)

πŸ“– Description

So this article is like... the big-picture lore of npm configuration in general. If you specifically wanna know about the config command itself, that's a different page β€” go check npm help config. 🫢

npm pulls its configuration values from a bunch of sources, and they're sorted by priority (first one wins, basically β€” top of the list is the loudest in the group chat):

🚩 Command Line Flags

You drop --foo bar on the command line and boom, the foo configuration parameter is now "bar". A -- argument tells the CLI parser to stop reading flags, like "ok we're done here, everything after this is a plain argument". πŸ›‘

And using --flag without giving it a value? It just sets the value to true. Free upgrade.

Example time: --flag1 --flag2 sets both configuration parameters to true. But --flag1 --flag2 bar sets flag1 to true and flag2 to bar. And finally, --flag1 --flag2 -- bar sets both configuration parameters to true, and bar gets treated as a command argument. See how that works? The -- is the vibe check. ✨

Common examples (these are the ones you'll actually use, no cap):

  • npm install --prefix /path/to/dir β€” runs npm commands in a different directory without changing your current working directory
  • npm install --global β€” installs packages globally (shorthand: -g)
  • npm install --save-dev β€” saves to devDependencies (shorthand: -D)

Every single configuration option documented down in that (Config Settings) section below? All of them can be set via command line flags using the --option-name value syntax. All of them. Slay. πŸ’…

🌍 Environment Variables

Any environment variable that starts with npm_config_ gets interpreted as a configuration parameter. So if you put npm_config_foo=bar in your environment, the foo configuration parameter becomes bar. Cute, right?

Any environment configurations that don't get given a value? They get the value true. Default behavior, love that for them.

Config values are case-insensitive, so NPM_CONFIG_FOO=bar works exactly the same. But β€” and this is the important part, listen up πŸ™ˆ β€” inside npm help scripts npm sets its own environment variables, and Node will prefer those lowercase versions over any uppercase ones you might set. For the details, see this issue: https://github.com/npm/npm/issues/14528.

Also notice you need underscores instead of dashes, so --allow-same-version would become npm_config_allow_same_version=true. The dashes-to-underscores pipeline is real. πŸŒ€

Important: when you're defining custom configuration keys in .npmrc files, use hyphens instead of underscores (like custom-key=value). This ensures they can actually be overridden by environment variables, since npm automatically converts underscores to hyphens when it reads environment variables. Keys with underscores in .npmrc files cannot be overridden via environment variables. Protect your overridability, bestie. πŸ›‘οΈ

πŸ“ npmrc Files

There are four relevant files, and yes you need to know all four:

  • per-project configuration file (/path/to/my/project/.npmrc)
  • per-user configuration file (defaults to $HOME/.npmrc; configurable via CLI option --userconfig or environment variable $NPM_CONFIG_USERCONFIG)
  • global configuration file (defaults to $PREFIX/etc/npmrc; configurable via CLI option --globalconfig or environment variable $NPM_CONFIG_GLOBALCONFIG)
  • npm's built-in configuration file (/path/to/npm/npmrc)

See npm help npmrc for more details. ✨

🧸 Default Configs

Run npm config ls -l to see a whole set of configuration parameters that are internal to npm, and that are the defaults if nothing else is specified. Basically the factory settings. The "before" picture. πŸŽ€

⌨️ Shorthands and Other CLI Niceties

These shorthands get parsed on the command line, and there are a LOT of them:

  • -a: --all
  • --enjoy-by: --before
  • -c: --call
  • --desc: --description
  • -f: --force
  • -g: --global
  • --iwr: --include-workspace-root
  • -L: --location
  • -d: --loglevel info
  • -s: --loglevel silent
  • --silent: --loglevel silent
  • --ddd: --loglevel silly
  • --dd: --loglevel verbose
  • --verbose: --loglevel verbose
  • -q: --loglevel warn
  • --quiet: --loglevel warn
  • -l: --long
  • -m: --message
  • --local: --no-global
  • -n: --no-yes
  • --no: --no-yes
  • -p: --parseable
  • --porcelain: --parseable
  • -C: --prefix
  • --readonly: --read-only
  • --reg: --registry
  • -S: --save
  • -B: --save-bundle
  • -D: --save-dev
  • -E: --save-exact
  • -O: --save-optional
  • -P: --save-prod
  • -?: --usage
  • -h: --usage
  • -H: --usage
  • --help: --usage
  • -v: --version
  • -w: --workspace
  • --ws: --workspaces
  • -y: --yes

If the configuration param you typed resolves unambiguously to a known configuration parameter, it gets expanded to that parameter. Like:

npm ls --par
# same as:
npm ls --parseable

And if you string multiple single-character shorthands together, and the resulting combo is unambiguously not some other configuration param, it gets expanded into its various component pieces. Watch:

npm ls -gpld
# same as:
npm ls --global --parseable --long --loglevel info

Combo move. Ate. πŸ”₯


βš™οΈ Config Settings

πŸ”‘ _auth

  • Default: null
  • Type: null or String

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'll need to scope it, like "//other-registry.tld/:_auth".

Warning: this should generally not be set via a command-line option. It's safer to use a registry-provided authentication bearer token stored in the ~/.npmrc file by running npm login. Keep your secrets out of your shell history, bestie. πŸ”πŸ˜­

πŸšͺ access

  • Default: 'public' for new packages; for existing packages it will not change the current level
  • Type: null, "restricted", "public", or "private"

If you do not want your scoped package to be publicly viewable (and installable), set --access=restricted.

Unscoped packages cannot be set to restricted. Sorry, rules are rules. 🚫

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.

The value private is an alias for restricted. Same energy, different word. πŸ’œ

🌈 all

  • Default: false
  • Type: Boolean

Show or act on all packages, not just the ones your project directly depends on. For npm outdated and npm ls this lists every outdated or installed package. For npm approve-scripts and npm deny-scripts it selects every package with pending install scripts. The whole roster, not just the starting lineup. πŸ‘‘

πŸ“‚ allow-directory

  • Default: "all"
  • Type: "all", "none", or "root"

Limits the ability for npm to install dependencies from directories. Like, dependencies that point to a directory instead of a version or semver range. Heads up though: this could leave your tree incomplete and some packages may not function as intended or designed. And changing this setting will not remove dependencies that are already installed. ⚠️

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. It also allows directory dependencies to be used for other commands like npm view. πŸŽ€

πŸ“¦ allow-file

  • Default: "all"
  • Type: "all", "none", or "root"

Limits the ability for npm to install dependencies from tarball files. As in, dependencies that point to a local tarball file instead of a version or semver range. Same disclaimer, bestie: 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.

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. ✨

πŸ™ allow-git

  • Default: "none"
  • Type: "all", "none", or "root"

Limits the ability for npm to fetch dependencies from git references β€” dependencies that point to a git repo instead of a version or semver range. And yeah, same warning as the others: 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.

As of npm 12 the default is none. Git dependencies run git against a remote repo and may install configuration the project does not control. Opt in explicitly per project (in .npmrc) or per command (on the CLI) when you need git deps. πŸ™ˆ

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. πŸ¦‹

🌐 allow-remote

  • Default: "none"
  • Type: "all", "none", or "root"

Limits the ability for npm to fetch dependencies from urls β€” dependencies that point to a tarball url instead of a version or semver range. Yep, the classic: 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.

As of npm 12 the default is none. Tarballs that share a hostname with the configured registry (the typical case for the npm registry, GitHub Packages, and most private registries) are still installed normally. If your registry serves tarballs from a different host, set replace-registry-host or override this setting. Opt in explicitly per project (in .npmrc) or per command (on the CLI) when you intentionally install from a URL. πŸ’…

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. 🌈

πŸ” allow-same-version

  • Default: false
  • Type: Boolean

Prevents throwing an error when npm version is used to set the new version to the same value as the current version. No drama, no explosion. Just vibes. 😌

πŸ“œ allow-scripts

  • Default: ""
  • Type: String (can be set multiple times)

A comma-separated list of packages whose install-time lifecycle scripts (preinstall, install, postinstall, and prepare for non-registry dependencies) are allowed to run.

This setting is intended for one-off and global contexts: npm exec, npx, and npm install -g, where no project package.json is involved. For team-wide policy in a project, use the allowScripts field in package.json (which also supports explicit denials), or configure it in .npmrc.

Passing --allow-scripts on the command line during a project-scoped npm install, ci, update, or rebuild is an error. Don't do it. It will not go well. πŸ’€

Each name is matched against a dependency's resolved identity, not against the package's self-reported name. --ignore-scripts and --dangerously-allow-all-scripts both override this setting.

This value is not exported to the environment for child processes. 🫢

allow-scripts-pending

  • Default: false
  • Type: Boolean

Lists the packages that have install scripts not yet covered by the allowScripts policy β€” and it does it without touching your package.json at all. Only meaningful for npm approve-scripts, bestie. πŸ’…

allow-scripts-pin

  • Default: true
  • Type: Boolean

Writes pinned (pkg@version) entries when you're approving install scripts. Set it to false and you get name-only entries instead, which allow any version β€” lowkey chaotic but okay. πŸ¦‹

Heads up though: this has no effect on npm deny-scripts, which always writes name-only entries regardless of what you set here.

allow-unused-patches

  • Default: false
  • Type: Boolean

Install anyway, even when a registered patch in patchedDependencies matches no installed package. And nope β€” it does not silence patch apply failures. Those still yell at you. 😭

This flag is only honored when passed on the command line. It's ignored in .npmrc and environment variables, and npm ci will outright reject it.

audit

  • Default: true
  • Type: Boolean

When "true", submits audit reports alongside the current npm command to the default registry and all the registries configured for scopes. Check out npm help audit for the deets on what actually gets submitted. πŸ”

audit-level

  • Default: null
  • Type: null, "info", "low", "moderate", "high", "critical", or "none"

The minimum vulnerability level that makes npm audit exit with a non-zero exit code. Basically: how much do you care. πŸ’€

auth-type

  • Default: "web"
  • Type: "legacy" or "web"

Which authentication strategy to use with login. Small catch: if an otp config is given, this value is always set to legacy. No discussion. ✨

before

  • Default: null
  • Type: null or Date

If you pass this to npm install, it rebuilds the npm tree so that only versions that were available on or before the given date get installed. And if there are no versions available for your current set of dependencies? The command errors out. πŸ™ˆ

If the requested version is a dist-tag and that tag doesn't pass the --before filter, the most recent version less than or equal to that tag gets used. Example: foo@latest might install foo@1.2 even though latest is 2.0. Wild but true.

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.

Same energy as min-release-age: when this cutoff blocks a fix that npm audit fix would install, npm keeps the vulnerable version, warns you, and exits with a non-zero code. πŸ’€

Packages whose names match min-release-age-exclude are exempt from this filter. πŸŽ€

  • Default: true
  • Type: Boolean

Tells npm to create symlinks (or .cmd shims on Windows) for package executables.

Set it to false and it won't do that. Real use case: working around file systems that don't support symlinks, even on ostensibly Unix systems. Rude of them honestly. 😀

browser

  • Default: macOS: "open", Windows: "start", Others: "xdg-open"
  • Type: null, Boolean, or String

The browser that npm commands call when they need to open websites. 🌈

  • Set to false to suppress browser behavior and print urls to the terminal instead.
  • Set to true to use the default system URL opener.

bypass-2fa

  • Default: false
  • Type: Boolean

When creating a Granular Access Token with npm token create, setting this to true lets the token bypass two-factor authentication. Perfect for automation and CI/CD workflows. πŸ‘‘

ca

  • Default: null
  • Type: null or String (can be set multiple times)

The Certificate Authority signing certificate that's trusted for SSL connections to the registry. Values go in PEM format (Windows calls it "Base-64 encoded X.509 (.CER)") with newlines replaced by the string "\n". Like this:

ca="-----BEGIN CERTIFICATE-----\nXXXX\nXXXX\n-----END CERTIFICATE-----"

Set it to null to only allow "known" registrars, or to a specific CA cert to trust only that specific signing authority.

You can trust multiple CAs by specifying an array of certificates:

ca[]="..."
ca[]="..."

See also the strict-ssl config. 🧚

cache

  • Default: Windows: %LocalAppData%\npm-cache, Posix: ~/.npm
  • Type: Path

The location of npm's cache directory. That's it, that's the whole vibe check. πŸ“

cafile

  • Default: null
  • Type: Path

A path to a file containing one or multiple Certificate Authority signing certificates. Similar to the ca setting, but it lets you have multiple CA's and keeps all that CA info stored in a file on disk. Very organized of you. ✨

call

  • Default: ""
  • Type: String

Optional companion option for npm exec, npx β€” lets you specify a custom command to run along with the installed packages:

npm exec --package yo --package generator-node --call "yo node"

cidr

  • Default: null
  • Type: null or String (can be set multiple times)

A list of CIDR address to be used when configuring limited access tokens with the npm token create command. πŸ”’

color

  • Default: true unless the NO_COLOR environ is set to something other than '0'
  • Type: "always" or Boolean
  • false β€” never shows colors.
  • "always" β€” always shows colors.
  • true β€” only prints color codes for tty file descriptors.

commit-hooks

  • Default: true
  • Type: Boolean

Run git commit hooks when using the npm version command. πŸŽ€

cpu

  • Default: null
  • Type: null or String

Override the CPU architecture of native modules to install. Acceptable values are the same as the cpu field of package.json, which comes from process.arch.

dangerously-allow-all-scripts

  • Default: false
  • Type: Boolean

If true, bypasses the allowScripts policy entirely and runs every dependency install script regardless of whether it was approved or denied.

Intended as a migration escape hatch only. Its use is strongly discouraged. 🚨 Also, --ignore-scripts still takes precedence over this setting.

depth

  • Default: Infinity if --all is set; otherwise, 0
  • Type: null or Number

The depth to go when recursing packages for npm ls.

If not set, npm ls shows only the immediate dependencies of the root project. If --all is set, then npm shows all dependencies by default. Go deep bestie. πŸŒ€

description

  • Default: true
  • Type: Boolean

Show the description in npm search. Iconic little detail, honestly. πŸ’…

diff

  • Default: (empty)
  • Type: String (can be set multiple times)

Define arguments to compare in npm diff.

diff-dst-prefix

  • Default: "b/"
  • Type: String

Destination prefix used in npm diff output.

diff-ignore-all-space

  • Default: false
  • Type: Boolean

Ignore whitespace when comparing lines in npm diff. The peacekeeper we deserve. πŸ•ŠοΈ

diff-name-only

  • Default: false
  • Type: Boolean

Prints only filenames when using npm diff.

diff-no-prefix

  • Default: false
  • Type: Boolean

Doesn't show any source or destination prefix in npm diff output.

Note: this causes npm diff to ignore the --diff-src-prefix and --diff-dst-prefix configs.

diff-src-prefix

  • Default: "a/"
  • Type: String

Source prefix used in npm diff output.

diff-text

  • Default: false
  • Type: Boolean

Treat all files as text in npm diff.

diff-unified

  • Default: 3
  • Type: Number

The number of lines of context to print in npm diff.

dry-run

  • Default: false
  • Type: Boolean

Says: don't actually change anything, just report what you would have done. You can pass it into any of the commands that modify your local installation, e.g. install, update, dedupe, uninstall, as well as pack and publish. 🫧

Note: this is NOT honored by other network related commands, e.g. dist-tags, owner, etc. Don't say we didn't warn you.

edit-dir

  • Default: null
  • Type: null or Path

Override the temporary directory used by npm patch add to prepare a package for editing. πŸ“

editor

  • Default: The EDITOR or VISUAL environment variables, or %SYSTEMROOT%\notepad.exe on Windows, or 'vi' on Unix systems
  • Type: String

The command to run for npm edit and npm config edit.

engine-strict

  • Default: false
  • Type: Boolean

If set to true, npm will stubbornly refuse to install (or even consider installing) any package that claims to not be compatible with the current Node.js version. Full main character energy, honestly. πŸ‘‘

This can be overridden by setting the --force flag.

expect-result-count

  • Default: null
  • Type: null or Number

Tells the command to expect a specific number of results.

This config cannot be used with: expect-results

expect-results

  • Default: null
  • Type: null or Boolean

Tells npm whether or not to expect results from the command. Can be either true (expect some results) or false (expect no results). ✨

This config cannot be used with: expect-result-count

expires

  • Default: null
  • Type: null or Number

When creating a Granular Access Token with npm token create, this sets the expiration in days. If you don't specify it, the server decides the default expiration. Not your call, bestie. πŸ’…

extension-file

  • Default: null
  • Type: null or Path

Path to a project-local npm extension file to load instead of discovering .npm-extension.mjs / .npm-extension.cjs at the project root. It must resolve inside the project root and use a .mjs or .cjs extension.

Only honored from project config or the command line β€” never from user, global, or builtin config. 🚫

fetch-retries

  • Default: 2
  • Type: Number

The "retries" config for the retry module to use when fetching packages from the registry.

npm will retry idempotent read requests to the registry in the case of network failures or 5xx HTTP errors. It's giving resilience. 🌸

fetch-retry-factor

  • Default: 10
  • Type: Number

The "factor" config for the retry module to use when fetching packages.

fetch-retry-maxtimeout

  • Default: 60000 (1 minute)
  • Type: Number

The "maxTimeout" config for the retry module to use when fetching packages.

fetch-retry-mintimeout

  • Default: 10000 (10 seconds)
  • Type: Number

The "minTimeout" config for the retry module to use when fetching packages.

fetch-timeout

  • Default: 300000 (5 minutes)
  • Type: Number

The maximum amount of time to wait for HTTP requests to complete. Tick tock. ⏳

force

  • Default: false
  • Type: Boolean

Like, that first bullet set is the entire personality of this option, so let's go through it one by one:

  • Allow clobbering non-npm files in global installs.
  • Allow the npm version command to work on an unclean git repository.
  • Allow deleting the cache folder with npm cache clean.
  • Allow installing packages that have an engines declaration requiring a different version of npm.
  • Allow installing packages that have an engines declaration requiring a different version of node, even if --engine-strict is enabled.
  • Allow npm audit fix to install modules outside your stated dependency range (including SemVer-major changes).
  • Allow unpublishing all versions of a published package.
  • Allow conflicting peerDependencies to be installed in the root project.
  • Implicitly set --yes during npm init.
  • Allow clobbering existing values in npm pkg.
  • Allow unpublishing of entire packages (not just a single version).
🚨 bestie, 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! Like, seriously. It is giving "yolo" in the worst way. πŸ’€

🌸 foreground-scripts

  • Default: false unless when using npm pack or npm publish where it defaults to true
  • Type: Boolean

Runs all the build scripts (ie, preinstall, install, and postinstall) for the installed packages in the foreground process, sharing standard input, output, and error with the main npm process.

Just so you know: this generally makes installs run slower and be much noisier 😭 but it's genuinely useful for debugging. Like turning the lights on in a messy room. πŸ”¦


πŸŽ€ format-package-lock

  • Default: true
  • Type: Boolean

Formats package-lock.json as a human readable file. Yes, readable by humans. We love accessibility. πŸ’–


πŸ’Έ fund

  • Default: true
  • Type: Boolean

When "true" it displays a message at the end of each npm install acknowledging the number of dependencies looking for funding. See npm help fund for the deets. Support your open source besties! 🫢


🧚 git

  • Default: "git"
  • Type: String

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. Classic "it's installed but it's hiding" situation. πŸ™ˆ


⭐ git-tag-version

  • Default: true
  • Type: Boolean

Tags the commit when you use the npm version command. Setting this to false results in no commit being made at all. Like, none. Zero. Nada. πŸ‘‘


🌍 global

  • Default: false
  • Type: Boolean

Operates in "global" mode, so packages get installed into the prefix folder instead of the current working directory. See npm help folders for more on the differences in behavior.

  • packages are installed into the {prefix}/lib/node_modules folder, instead of the current working directory.
  • bin files are linked to {prefix}/bin
  • man pages are linked to {prefix}/share/man

Three little consequences, all iconic. ✨


🚫 global-ignore-file

  • Default: The global --prefix setting plus 'etc/npmignore'. For example, '/usr/local/etc/npmignore'
  • Type: Path

An additional ignore file applied during npm pack and npm publish, owned by the current user rather than the package. Patterns follow the same syntax as a package's local .npmignore file. Useful for keeping editor metadata (such as .idea/ or *.iml) and scratch directories out of every package you publish, without adding them to each package's own ignore rules. Literally the "set it once, forget it" of ignoring. 🧹

The global rules apply in addition to a package's local .npmignore. When a package uses a files field in its package.json, an entry in files that contradicts a global rule (i.e., explicitly includes a path the global rule would exclude) still wins. Contradiction resolved, bestie. 🫑


πŸ—‚οΈ globalconfig

  • Default: The global --prefix setting plus 'etc/npmrc'. For example, '/usr/local/etc/npmrc'
  • Type: Path

The config file to read for global config options.


🏷️ heading

  • Default: "npm"
  • Type: String

The string that starts all the debugging log output. Your logs, your branding. πŸ’…


πŸ” https-proxy

  • Default: null
  • Type: null or URL

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. It just picks them up, no extra work from you. ✨


πŸ¦‹ if-present

  • Default: false
  • Type: Boolean

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. Conditional slay. 🎯

This value is not exported to the environment for child processes.


πŸ™… ignore-existing

  • Default: false
  • Type: Boolean

With npm patch add, discards a previous unfinished edit directory and starts fresh. Clean slate energy. 🌈


🚫 ignore-extension

  • Default: false
  • Type: Boolean

If true, npm does not import or execute a root .npm-extension.mjs / .npm-extension.cjs file (or one selected via extension-file). ignore-scripts implies ignore-extension, since both disable root-owned install-time code. No root-owned install-time code, no problems. πŸ‘‘


🩹 ignore-patch-failures

  • Default: false
  • Type: Boolean

Install even when a registered patch fails to apply, with a warning per failure. Intended for incident response only. 🚨

This flag is only honored when passed on the command line; it is ignored in .npmrc and environment variables, and rejected by npm ci. So like, don't try to sneak it in anywhere else, it won't work. πŸ’€

πŸ”‡ ignore-scripts

  • Default: false
  • Type: Boolean

If true, npm does not run scripts specified in package.json files.

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. Main event only, no opening act. 🎀

Setting ignore-scripts also disables .npm-extension execution, as if ignore-extension were set. Two for one, lowkey.


πŸ“¦ include

  • Default: (empty)
  • Type: "prod", "dev", "optional", or "peer" (can be set multiple times)

Option that allows for defining which types of dependencies to install.

This is the inverse of --omit=<type>. The way that works is genuinely so satisfying ngl. πŸ”₯

Dependency types specified in --include will not be omitted, regardless of the order in which omit/include are specified on the command-line. Order doesn't matter, include wins. Periodt. πŸ’…


πŸ” include-attestations

  • Default: false
  • Type: Boolean

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. Yes, all of it, the whole receipt. 🧾✨


πŸ§ͺ include-staged

  • Default: false
  • Type: Boolean

Allow installing "staged" published packages, as defined by npm RFC PR #92 https://github.com/npm/rfcs/pull/92.

This is experimental, and not implemented by the npm public registry. Like, it exists but nobody's home. 🫠

🌱 include-workspace-root

  • Default: false
  • Type: Boolean

Include the workspace root when workspaces are enabled for a command.

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. Root gets left on read. 😭

This value is not exported to the environment for child processes.


πŸ’Œ init-author-email

  • Default: ""
  • Type: String

The value npm init should use by default for the package author's email.


πŸͺͺ init-author-name

  • Default: ""
  • Type: String

The value npm init should use by default for the package author's name.


πŸ”— init-author-url

  • Default: ""
  • Type: "" or URL

The value npm init should use by default for the package author's homepage.


βš–οΈ init-license

  • Default: ""
  • Type: String

The value npm init should use by default for the package license. If not set, the license field will be omitted from new packages. No license, no problem? Well. πŸ‘€


🧩 init-module

  • Default: "~/.npm-init.js"
  • Type: Path

A module that will be loaded by the npm init command. See the documentation for the init-package-json module (https://github.com/npm/init-package-json) for more information, or npm help init. Custom init behavior, curated by you. πŸŽ€


πŸ”’ init-private

  • Default: false
  • Type: Boolean

The value npm init should use by default for the package's private flag.


🏷️ init-type

  • Default: "commonjs"
  • Type: String

The value that npm init should use by default for the package.json type field. Choose your fighter. βš”οΈ


#️⃣ init-version

  • Default: "1.0.0"
  • Type: SemVer string

The value that npm init should use by default for the package version number, if not already set in package.json. The classic 1.0.0. An icon. πŸ‘‘


  • Default: false
  • Type: Boolean

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. Zero. None. 🚫


πŸ—ΊοΈ install-strategy

  • Default: "hoisted"
  • Type: "hoisted", "nested", "shallow", or "linked"

Sets the strategy for installing packages in node_modules. Let's break it down bestie:

  • 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: install in node_modules/.store, link in place, unhoisted.

We recommend that package authors use --install-strategy=linked during development to catch undeclared ("phantom") dependencies before publishing: the isolated layout only exposes a package's declared dependencies, so an import of a package that was never added to package.json can fail instead of resolving by accident and shipping broken. See "Catching undeclared ("phantom") dependencies" at /using-npm/developers#catching-undeclared-phantom-dependencies. Catch the phantoms before you ship, fr fr. πŸ‘»πŸ”₯


🧾 json

  • Default: false
  • Type: Boolean

Whether or not to output JSON data, rather than the normal output.

  • In npm pkg set it enables parsing set values with JSON.parse() before saving them to your package.json.
Not supported by all npm commands. Check before you count on it. πŸ™ˆ

πŸ“ keep-edit-dir

  • Default: false
  • Type: Boolean

With npm patch commit, do not remove the edit directory after committing the patch. Your files, kept. 🫢


πŸ‘― legacy-peer-deps

  • Default: false
  • Type: Boolean

Causes npm to completely ignore peerDependencies when building a package tree, as in npm versions 3 through 6. Blast from the past, honestly. πŸ•°οΈ

If a package cannot be installed because of overly strict peerDependencies that collide, it provides a way to move forward resolving the situation. It's the escape hatch. πŸšͺ

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. Different vibes entirely, iykyk. πŸ’…

⚠️ Using legacy-peer-deps is not recommended β€” it won't enforce the peerDependencies contract that meta-dependencies might be relying on. Like, it works, but it's giving "borrowed your ex's hoodie and now everything smells like drama." πŸ™ˆ

libc

  • Default: null
  • Type: null or String

Override the libc of native modules you're installing. The acceptable values are the same as the libc field of package.json. ✨

  • Default: false
  • Type: Boolean

Used with npm ls β€” it limits the output to only those packages that are linked. Nothing else, just the linked besties. πŸ”—

local-address

  • Default: null
  • Type: IP Address

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 β€” yes, ancient, but the docs said it so I'm saying it. πŸ’…

location

  • Default: "user" unless --global is passed, which will also set this value to "global"
  • Type: "global", "user", or "project"

When you pass this to npm config it refers to which config file to use.

When set to "global" mode, packages are installed into the prefix folder instead of the current working directory. Peep npm help folders for more on how the behavior differs:

  • packages are installed into the {prefix}/lib/node_modules folder, instead of the current working directory
  • bin files are linked to {prefix}/bin
  • man pages are linked to {prefix}/share/man

lockfile-version

  • Default: Version 3 if no lockfile, auto-converting v1 lockfiles to v3; otherwise, maintain current lockfile version
  • Type: null, 1, 2, 3, "1", "2", or "3"

Sets the lockfile format version used in package-lock.json files. The possible options, bestie:

1: The lockfile version used by npm versions 5 and 6. Lacks some data that's used during the install, which means slower and possibly less deterministic installs. It prevents lockfile churn when you're interoperating with older npm versions.

2: The default lockfile version used by npm version 7 and 8. Includes both the version 1 lockfile data and the version 3 lockfile data, for maximum determinism and interoperability β€” at the expense of more bytes on disk. 🫢

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 literally everyone is on npm version 7 and higher.

loglevel

  • Default: "notice"
  • Type: "silent", "error", "warn", "notice", "http", "info", "verbose", or "silly"

What level of logs to report. Every log gets written to a debug log, and the path to that file gets printed if the execution of a command fails. πŸ›

Any logs of a higher level than the setting are shown. The default is "notice".

Also see the foreground-scripts config.

logs-dir

  • Default: A directory named _logs inside the cache
  • Type: null or Path

The location of npm's log directory. See npm help logging for more info. πŸ“‚

logs-max

  • Default: 10
  • Type: Number

The maximum number of log files to store.

If set to 0, no log files will be written for the current run. Zero logs, zero evidence. πŸ•΅οΈ

long

  • Default: false
  • Type: Boolean

Show extended information in ls, search, and help-search. iykyk β€” more columns, more lore.

maxsockets

  • Default: 15
  • Type: Number

The maximum number of connections to use per origin (that's the protocol/host/port combination, bestie).

message

  • Default: "%s"
  • Type: String

The commit message used by npm version when it creates the version commit.

Any "%s" in the message gets replaced with the version number. Cute, right? ✨

min-release-age

  • Default: null
  • Type: null or Number

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. 😭

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.

When this window stops npm audit fix from installing a patched version (because the fix was published too recently), npm keeps the package at its vulnerable version, warns that the fix was blocked, and exits with a non-zero code. To install the fix, add the package to min-release-age-exclude, or relax min-release-age or before.

Packages whose names match min-release-age-exclude are exempt from this filter.

🫢 Heads up: this value is not exported to the environment for child processes.

min-release-age-exclude

  • Default: (empty)
  • Type: String (can be set multiple times)

A list of package names or minimatch glob patterns that are exempt from the min-release-age (and before) filter. A matching package can always resolve to its newest version, even when a release-age window is set. πŸ‘‘

For example, to apply a release-age window to third-party dependencies while letting internally maintained packages update immediately:

min-release-age=7
min-release-age-exclude[]=@myorg/*
min-release-age-exclude[]=my-internal-pkg

Only the named package is exempt; its own dependencies still follow the release-age policy unless they also match a pattern. Patterns match against the package name, so @myorg/* matches @myorg/shared-utils.

Excluding a package does not change which registry it is fetched from. You should own your private scope on the public registry so that nobody else can publish a package with the same name. πŸ”’

This value is not exported to the environment for child processes either.

name

  • Default: null
  • Type: null or String

When creating a Granular Access Token with npm token create, this sets the name/description for the token. Give it a cute label, bestie. πŸŽ€

node-gyp

  • Default: The path to the node-gyp bin that ships with npm
  • Type: Path

This is the location of the "node-gyp" bin. By default it uses the one that ships with npm itself.

You can use this config to specify your own "node-gyp" to run when it's required to build a package. Main character build tool energy. πŸ”§

node-options

  • Default: null
  • Type: null or String

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.

noproxy

  • Default: The value of the NO_PROXY environment variable
  • Type: String (can be set multiple times)

Domain extensions that should bypass any proxies.

Also accepts a comma-delimited string. 🌸

offline

  • Default: false
  • Type: Boolean

Force offline mode: no network requests will be done during install. To allow the CLI to fill in missing cache data, see --prefer-offline. ✈️

omit

  • Default: 'dev' if the NODE_ENV environment variable is set to 'production'; otherwise, empty
  • Type: "dev", "optional", or "peer" (can be set multiple times)

Dependency types to omit from the installation tree on disk.

Note that these dependencies are still resolved and added to the package-lock.json file. They're just not physically installed on disk.

If a package type appears in both the --include and --omit lists, then it will be included. (Include wins, always.)

If the resulting omit list includes 'dev', then the NODE_ENV environment variable will be set to 'production' for all lifecycle scripts.

omit-lockfile-registry-resolved

  • Default: false
  • Type: Boolean

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 β€” which likely means a longer install time. πŸ’€

orgs

  • Default: null
  • Type: null or String (can be set multiple times)

When creating a Granular Access Token with npm token create, this limits the token access to specific organizations.

orgs-permission

  • Default: null
  • Type: null, "read-only", "read-write", or "no-access"

When creating a Granular Access Token with npm token create, this sets the permission level for organizations. The options are "read-only", "read-write", or "no-access".

os

  • Default: null
  • Type: null or String

Override the OS of native modules to install. Acceptable values are the same as the os field of package.json, which comes from process.platform. πŸ–₯️

otp

  • Default: null
  • Type: null or String

This is a one-time password from a two-factor authenticator. It's needed when publishing or changing package permissions with npm access.

If it's not set, and a registry response fails with a challenge for a one-time password, npm will prompt on the command line for one. No cap, it'll just ask you. πŸ”

pack-destination

  • Default: "."
  • Type: String

Directory in which npm pack will save tarballs. πŸ“¦

package

  • Default: (empty)
  • Type: String (can be set multiple times)

The package or packages to install for npm help exec. Yep, that's the whole thing.

package-lock

  • Default: true
  • Type: Boolean

If set to false, then ignore package-lock.json files when installing. This will also prevent writing package-lock.json if save is true. πŸ™ˆ

package-lock-only

  • Default: false
  • Type: Boolean

If set to true, the current operation will only use the package-lock.json, ignoring node_modules.

For update this means only the package-lock.json will be updated, instead of checking node_modules and downloading dependencies.

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.

packages

  • Default: (empty)
  • Type: null or String (can be set multiple times)

When creating a Granular Access Token with npm token create, this limits the token access to specific packages.

packages-all

  • Default: false
  • Type: Boolean

When creating a Granular Access Token with npm token create, this grants the token access to all packages instead of limiting it to specific packages. Go big or go home. πŸ‘‘

packages-and-scopes-permission

  • Default: null
  • Type: null, "read-only", "read-write", "read-write-stage-only", or "no-access"

When creating a Granular Access Token with npm token create, this sets the permission level for packages and scopes. The options are "read-only", "read-write", "read-write-stage-only", or "no-access". "read-write-stage-only" grants publish access that stages releases instead of publishing them directly. Very demure, very mindful. πŸŽ€

parseable

  • Default: false
  • Type: Boolean

Output parseable results from commands that write to standard output. For npm search, this will be tab-separated table format. Perfect for piping into stuff, bestie. 🫢

password

  • Default: null
  • Type: null or String

(and that's where this part cuts off β€” the description continues in the next bit!) πŸ”₯

Password for auth β€” you can pass it on the command line when you're creating tokens, but honestly bestie, just let it prompt you. Way safer that way, fr fr. πŸ”


πŸŽ€ patches-dir

  • Default: "patches"
  • Type: String

The directory β€” relative to the project root, okay β€” where npm patch commit drops the patch files for patchedDependencies. That's it, that's the whole vibe. πŸ“

πŸ’… prefer-dedupe

  • Default: false
  • Type: Boolean

When it's a choice between deduping packages or grabbing a shinier newer version of a dependency, this says: dedupe first, bestie. Keep it tidy. 🧚

🌸 prefer-offline

  • Default: false
  • Type: Boolean

Set it true and npm skips the staleness checks on your cached data β€” but like, if something's missing it'll still go ask the server for it. So it's not true offline mode, it's just "chill on the checking." For the full goblin-mode no-internet experience, use --offline instead. πŸ¦‹

⭐ prefer-online

  • Default: false
  • Type: Boolean

The opposite energy: true means staleness checks are forced, so the CLI goes looking for updates immediately, even when the package data is fresh-fresh. Impatient queen behavior, we respect it. πŸ”₯

πŸ‘‘ prefix

  • 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.
  • Type: Path

Where global stuff gets installed. And if you set it on the command line, plot twist β€” it forces your non-global commands to run in that specified folder too. πŸ’«

πŸ“ preid

  • Default: ""
  • Type: String

The "prerelease identifier" β€” the little prefix that goes on the "prerelease" part of a semver. You know the rc in 1.2.0-rc.8? That's her. πŸŽ€

🌈 progress

  • Default: true when not in CI and both stderr and stdout are TTYs and not in a dumb terminal
  • Type: Boolean

true means npm shows you a progress bar during the time-intensive operations β€” but only if process.stderr and process.stdout are a TTY. Set it false to suppress the bar entirely. No progress bar, no problem. ✨

πŸ’œ provenance

  • Default: false
  • Type: Boolean

When you publish from a supported cloud CI/CD system, your package gets publicly linked to where it was built and published from. Transparency slay. 🫢

When the provenance-file config is set, it takes precedence and automatic provenance generation (including via trusted publishing/OIDC) is skipped.

This config cannot be used with: provenance-file 🚫

🧚 provenance-file

  • Default: null
  • Type: Path

When publishing, the provenance bundle sitting at the given path gets used. This takes precedence over automatic provenance generation in trusted publishing flows.

This config cannot be used with: provenance 🚫

🌸 proxy

  • Default: null
  • Type: null, false, or URL

A proxy for your outgoing http requests. And heads up β€” if HTTP_PROXY or http_proxy environment variables are set, the underlying request library will honor those proxy settings. πŸ‘€

πŸ’… read-only

  • Default: false
  • Type: Boolean

Marks a token as unable to publish β€” used when you're configuring limited access tokens with the npm token create command. Read-only era. πŸ”’

πŸŽ€ rebuild-bundle

  • Default: true
  • Type: Boolean

Rebuild bundled dependencies after installation. Yes ma'am. πŸ”¨

⭐ registry

The base URL of the npm registry. The main character URL, if you will. πŸ‘‘

πŸ¦‹ replace-registry-host

  • Default: "npmjs"
  • Type: "npmjs", "never", "always", or String

This one controls how the registry host in a lockfile gets replaced with your configured registry. Buckle up, there's layers:

  • The default behavior replaces package dist URLs from the default registry (https://registry.npmjs.org) with the configured registry.
  • Set it to "never" and it just uses the registry value.
  • Set it to "always" and the registry host gets replaced with the configured host every single time.
  • You may also specify a bare hostname (e.g., "registry.npmjs.org") to only replace URLs coming from that host.
  • You may also specify a full URL including a path (e.g., "https://old-registry.example.com/npm/path"). In that case, resolved URLs whose host and path begin with that prefix will have the entire prefix replaced with the configured registry URL (host and path), without duplicating path segments. No dupe segments, we don't do that here. πŸ’€

🌸 save

  • Default: true unless when using npm update where it defaults to false
  • Type: Boolean

Saves installed packages into your package.json as dependencies. When used with the npm rm command, it removes the dependency from package.json instead. And if you set it to false, it'll also prevent writing to package-lock.json. 🫢

πŸ’– save-bundle

  • Default: false
  • Type: Boolean

If a package would be saved at install time via --save, --save-dev, or --save-optional, then also stick it in the bundleDependencies list. Ignored if --save-peer is set, since peerDependencies cannot be bundled. Periodt. 🎁

🧚 save-dev

  • Default: false
  • Type: Boolean

Saves installed packages to package.json as devDependencies.

This config cannot be used with: save-optional, save-peer, save-prod 🚫

✨ save-exact

  • Default: false
  • Type: Boolean

Dependencies saved to package.json get an exact version instead of npm's default semver range operator. Pin it down, no drift. πŸ“Œ

πŸ“ save-optional

  • Default: false
  • Type: Boolean

Saves installed packages to package.json as optionalDependencies.

This config cannot be used with: save-dev, save-peer, save-prod 🚫

πŸ’œ save-peer

  • Default: false
  • Type: Boolean

Saves installed packages to package.json as peerDependencies.

This config cannot be used with: save-dev, save-optional, save-prod 🚫

🌈 save-prefix

  • Default: "^"
  • Type: String

Controls how versions of packages installed to package.json via --save or --save-dev get prefixed. Example time, because this one's cute:

Say 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'd be set to ~1.2.3, which only allows patch upgrades. Small change, big difference. πŸŽ€

πŸ‘‘ save-prod

  • Default: false
  • Type: Boolean

Saves installed packages into dependencies specifically. Super useful if a package already exists in devDependencies or optionalDependencies but you want to move it to be a non-optional production dependency. Glow-up moment. πŸ’…

This is the default behavior if --save is true, and neither --save-dev or --save-optional are true.

This config cannot be used with: save-dev, save-optional, save-peer 🚫

πŸ¦‹ sbom-format

  • Default: null
  • Type: "cyclonedx" or "spdx"

Which SBOM format to use when generating SBOMs. Pick your fighter. βš”οΈ

🌸 sbom-type

  • Default: "library"
  • Type: "library", "application", or "framework"

The type of package described by the generated SBOM. For SPDX, this is the value for the primaryPackagePurpose field. For CycloneDX, it's the value for the type field. Two formats, two field names, one vibe. 🫢

πŸŽ€ scope

  • Default: the scope of the current project, if any, or ""
  • Type: String

Associates an operation with a scope for a scoped registry. Genuinely so useful when you're logging in to or out of a private registry:

# log in, linking the scope to the custom registry
npm login --scope=@mycorp --registry=https://registry.mycorp.com

# log out, removing the link and the auth token
npm logout --scope=@mycorp

This causes @mycorp to be mapped to that registry for future installs of packages specified according to the pattern @mycorp/package.

It'll also make npm init create a scoped package:

# accept all defaults, and create a package named "@foo/whatever",
# instead of just named "whatever"
npm init --scope=@foo --yes

Obsessed, honestly. 🌟

πŸ’– scopes

  • Default: null
  • Type: null or String (can be set multiple times)

When creating a Granular Access Token with npm token create, this limits the token's access to specific scopes. Just hand it a scope name (with or without the @ prefix). 🎟️

⭐ script-shell

  • Default: '/bin/sh' on POSIX systems, 'cmd.exe' on Windows
  • Type: null or String

The shell used for scripts run with the npm exec, npm run and npm init <package-spec> commands. 🐚

🧚 searchexclude

  • Default: ""
  • Type: String

Space-separated options that limit the results from search. Filter her. πŸ”

πŸ”₯ searchlimit

  • Default: 20
  • Type: Number

How many items to limit search results to. Ngl, it will not apply at all to legacy searches. πŸ’€

🌸 searchopts

  • Default: ""
  • Type: String

Space-separated options that are always passed to search. Always always. πŸ’«

πŸ¦‹ searchstaleness

  • Default: 900
  • Type: Number

The age of the cache, in seconds, before another registry request gets made β€” if you're using the legacy search endpoint. ⏳

πŸ’… shell

  • Default: SHELL environment variable, or "bash" on Posix, or "cmd.exe" on Windows
  • Type: String

The shell to run for the npm explore command. Go explore, bestie. πŸ—ΊοΈ

πŸ” sign-git-commit

  • Default: false
  • Type: Boolean

Set it true and the npm version command will commit the new package version using -S to add a signature.

Heads up: git requires you to have set up GPG keys in your git configs for this to actually work properly. Like, no cap, it will not just magically work. πŸ”‘πŸ«Ά

πŸŽ€ sign-git-tag

  • Default: false
  • Type: Boolean

Set it true and the npm version command will tag the version using -s to add a signature.

Same caveat as above, bestie: git needs your GPG keys set up in your git configs for this to work properly. πŸ™ˆ

πŸ’€ strict-allow-scripts

  • Default: false
  • Type: Boolean

If true, the install-script policy levels up from "warning" to "hard error": any dependency with install scripts that isn't covered by allowScripts will fail the install instead of being blocked with just a warning. Gloves off. πŸ₯Š

Dependencies explicitly denied with false in allowScripts are always silently skipped β€” this setting only affects unreviewed entries (packages with install scripts that are neither approved nor denied). Both --ignore-scripts and --dangerously-allow-all-scripts override this setting.

Optional dependencies that cannot be installed on the current platform or engine (a non-matching os, cpu, or libc) are not flagged, because their install scripts never run. Nothing to run, nothing to flag. πŸ’…

🌈 strict-npmrc

  • Default: false
  • Type: Boolean

If true, unknown configuration keys found in .npmrc files become a hard error instead of a warning. Snitch mode: activated. πŸ“’

Unknown command line flags and abbreviated flags always error regardless of this setting. Like, always always. ⚠️

πŸ‘‘ strict-peer-deps

  • Default: false
  • Type: Boolean

If true, and --legacy-peer-deps is not set, then any conflicting peerDependencies are treated as an install failure β€” even if npm could reasonably guess the appropriate resolution based on non-peer dependency relationships. No guessing, no mercy. 😀

By default, conflicting peerDependencies deep in the dependency graph get resolved using the nearest non-peer dependency specification β€” even if doing so results in some packages receiving a peer dependency outside the range set in their package's peerDependencies object. That's the default vibe, for better or worse. πŸŒ€

When that kind of override actually happens, npm prints a warning that spells out the conflict and names the packages caught up in it. But if --strict-peer-deps is set? That warning is not a vibe, it's a failure. Bye. πŸ’€


  • strict-ssl β€” do we validate SSL keys or not, that is the question πŸ”
    • Default: true
    • Type: Boolean

Whether or not to do SSL key validation when making requests to the registry via https.

See also the ca config. (iykyk, go read it 🫢)


  • tag β€” the default flavour of your install, bestie 🏷️
    • Default: "latest"
    • Type: String

If you ask npm to install a package and don't tell it a specific version, then it will install the specified tag.

It's also the tag added to the package@version specified in the npm dist-tag add command, if no explicit tag is given.

When it's 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.

And if you use it in the npm publish command, this is the tag that gets added to the package submitted to the registry. Slay, consistent behaviour ✨


  • tag-version-prefix β€” the little v before your version, iconic but changeable πŸŽ€
    • Default: "v"
    • Type: String

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: "".

Real talk: 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. Like, be so careful. πŸ™ˆ

  • timing β€” receipts for how long everything took ⏱️
    • Default: false
    • Type: Boolean

If true, writes timing information to a process specific json file in the cache or logs-dir. The file name ends with -timing.json.

You can quickly view it with this json ⟨https://npm.im/json⟩ command line: cat ~/.npm/_logs/*-timing.json | npm exec -- json -g.

Timing information will also be reported in the terminal. To suppress this while still writing the timing file, use --silent.


  • to β€” the rebase target for npm patch update 🎯
    • Default: null
    • Type: null or String

Used by npm patch update to set the version to rebase a patch onto when it cannot be read from package-lock.json β€” for example an exact-version selector, or a version that has not been installed yet.


  • token-description β€” label your token, queen πŸ‘‘
    • Default: null
    • Type: null or String

Description text for the token when using npm token create.


  • umask β€” the permission mask, octal and a lil mysterious πŸ”’
    • Default: 0
    • Type: Octal numeric string in range 0000..0777 (0..511)

The "umask" value to use when setting the file creation mode on files and folders.

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.

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.

So 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. Math but make it filesystem ✨


  • unicode β€” pretty glyphs or plain ascii, your call 🌸
    • 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.
    • Type: Boolean

When set to true, npm uses unicode characters in the tree output. When false, it uses ascii characters instead of unicode glyphs. The tree goes from 🌳 to |--, basically.


  • update-notifier β€” that "hey new npm dropped" nudge πŸ¦‹
    • Default: true
    • Type: Boolean

Set to false to suppress the update notification when using an older version of npm than the latest.


  • usage β€” quick little how-do-I-use-this πŸ“–
    • Default: false
    • Type: Boolean

Show short usage output about the command specified.


  • user-agent β€” who npm says it is when it knocks on the registry's door 🫢
    • Default: "npm/{npm-version} node/{node-version} {platform} {arch} workspaces/{workspaces} {ci}"
    • Type: String

Sets the User-Agent request header. The following fields are replaced with their actual counterparts:

  • {npm-version} - The npm version in use
  • {node-version} - The Node.js version in use
  • {platform} - The value of process.platform
  • {arch} - The value of process.arch
  • {workspaces} - Set to true if the workspaces or workspace options are set.
  • {ci} - The value of the ci-name config, if set, prefixed with ci/, or an empty string if ci-name is empty.

  • userconfig β€” where your personal settings live 🏠
    • Default: "~/.npmrc"
    • Type: Path

The location of user-level configuration settings.

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. Them's the rules, no cap.


  • version β€” just tell me the version and go ⭐
    • Default: false
    • Type: Boolean

If true, output the npm version and exit successfully.

Only relevant when specified explicitly on the command line.


  • versions β€” the whole version lore drop πŸ’…
    • Default: false
    • Type: Boolean

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.

Only relevant when specified explicitly on the command line.


  • viewer β€” who gets to show you the help content πŸ‘€
    • Default: "man" on Posix, "browser" on Windows
    • Type: String

The program to use to view help content.

Set to "browser" to view html help content in the default web browser.


  • which β€” when there's more than one funding link, pick your fighter πŸ’Έ
    • Default: null
    • Type: null or Number

If there are multiple funding sources, which 1-indexed source URL to open.


  • workspace β€” run stuff in this specific workspace, not all of them 🎯
    • Default:
    • Type: String (can be set multiple times)

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.

Valid values for the workspace config are either:

  • Workspace names
  • Path to a workspace directory
  • Path to a parent workspace directory (will result in selecting all workspaces within that folder)

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. Main character energy for a folder that literally doesn't exist yet πŸ’–

This value is not exported to the environment for child processes.


  • workspaces β€” all the workspaces, at once, go off 🌈
    • Default: null
    • Type: null or Boolean

Set to true to run the command in the context of all configured workspaces.

Explicitly setting this to false will cause commands like install to ignore workspaces altogether. When not set explicitly:

  • 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.

This value is not exported to the environment for child processes.


  • workspaces-update β€” keep the workspace links fresh πŸ”„
    • Default: true
    • Type: Boolean

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.


  • yes β€” auto-yes, no more prompts, we're free 😭
    • Default: null
    • Type: null or Boolean

Automatically answer "yes" to any prompts that npm might print on the command line.


  • also β€” old alias, respectfully retired 🫑
    • Default: null
    • Type: null, "dev", or "development"
    • DEPRECATED: Please use --include=dev instead.

When set to dev or development, this is an alias for --include=dev.


  • cache-max β€” deprecated, but immortalized here πŸ“œ
    • Default: Infinity
    • Type: Number
    • DEPRECATED: This option has been deprecated in favor of --prefer-online

--cache-max=0 is an alias for --prefer-online


  • cache-min β€” same deal, different direction πŸ“œ
    • Default: 0
    • Type: Number
    • DEPRECATED: This option has been deprecated in favor of --prefer-offline.

--cache-min=9999 (or bigger) is an alias for --prefer-offline.


  • cert β€” your client certificate, legacy era πŸͺ¦
    • Default: null
    • Type: null or String
    • 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

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:

cert="-----BEGIN CERTIFICATE-----\nXXXX\nXXXX\n-----END CERTIFICATE-----"

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".


  • dev β€” yes it's basically --include=dev, no it's not the move anymore πŸŽ€
    • Default: false
    • Type: Boolean
    • DEPRECATED: Please use --include=dev instead.

Alias for --include=dev.


  • global-style β€” the shallow install strategy's grandparent πŸ’€
    • Default: false
    • Type: Boolean
    • DEPRECATED: This option has been deprecated in favor of --install-strategy=shallow

Only install direct dependencies in the top level node_modules, but hoist on deeper dependencies. Sets --install-strategy=shallow.


  • init.author.email β€” dotted name, old money πŸ’Œ
    • Default: ""
    • Type: String
    • DEPRECATED: Use --init-author-email instead.

Alias for --init-author-email


  • init.author.name β€” same but for your name ✨
    • Default: ""
    • Type: String
    • DEPRECATED: Use --init-author-name instead.

Alias for --init-author-name


  • init.author.url β€” and your link 🌸
    • Default: ""
    • Type: "" or URL
    • DEPRECATED: Use --init-author-url instead.

Alias for --init-author-url


  • init.license β€” dotted license config, ancient relic πŸ“œ
    • Default: ""
    • Type: String
    • DEPRECATED: Use --init-license instead.

Alias for --init-license


  • init.module β€” the old init module path πŸ—‚οΈ
    • Default: "~/.npm-init.js"
    • Type: Path
    • DEPRECATED: Use --init-module instead.

Alias for --init-module


  • init.version β€” the OG starting version 🍼
    • Default: "1.0.0"
    • Type: SemVer string
    • DEPRECATED: Use --init-version instead.

Alias for --init-version


  • key β€” client key, also legacy era πŸͺ¦
    • Default: null
    • Type: null or String
    • 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

A client key to pass when accessing the registry. Values should be in PEM format with newlines replaced by the string "\n". For example:

key="-----BEGIN PRIVATE KEY-----\nXXXX\nXXXX\n-----END PRIVATE KEY-----"

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".


  • legacy-bundling β€” the nested-strategy throwback πŸ•°οΈ
    • Default: false
    • Type: Boolean
    • DEPRECATED: This option has been deprecated in favor of --install-strategy=nested
  • nested β€” so instead of hoisting your package installs into node_modules, packages get installed in the same manner that they're depended on 🫢. Heads up though: this may cause very deep directory structures and duplicate package installs, because there's literally no de-duplicating happening. Sets --install-strategy=nested. No cap, it's giving "trust the process" energy πŸ’€.

πŸ’… only

  • Default: null
  • Type: null, "prod", or "production"
  • DEPRECATED: use --omit=dev to omit dev dependencies from the install.

When you set it to prod or production, this is just an alias for --omit=dev. That's it, that's the whole vibe ✨.


πŸŽ€ optional

  • Default: null
  • Type: null or Boolean
  • DEPRECATED: use --omit=optional to exclude optional dependencies, or --include=optional to include them.

The default value does install optional deps unless they're otherwise omitted 🫢.

It's an alias for --include=optional or --omit=optional β€” pick your fighter, bestie.


🌸 production

  • Default: null
  • Type: null or Boolean
  • DEPRECATED: use --omit=dev instead.

Alias for --omit=dev. Short, sweet, and lowkey retired, ngl.


πŸ¦‹ SEE ALSO πŸ¦‹

  • npm help config
  • npm help npmrc
  • npm help scripts
  • npm help folders
  • npm help npm

and that's the whole page, bestie, you ate that πŸ’…βœ¨ This icon of a document is npm@12.2.1, filed under NPM-CONFIG(7) β€” literally main character energy for a manpage πŸŽ€πŸ‘‘πŸ’–

πŸ“¦ where this page comes from