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 directorynpm install --globalβ installs packages globally (shorthand:-g)npm install --save-devβ saves todevDependencies(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.npmrcfiles, use hyphens instead of underscores (likecustom-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.npmrcfiles 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--userconfigor environment variable$NPM_CONFIG_USERCONFIG) - global configuration file (defaults to
$PREFIX/etc/npmrc; configurable via CLI option--globalconfigor 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:
nullorString
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~/.npmrcfile by runningnpm 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 ofrestrictedorpublicduring publish will change the access for an existing package the same way thatnpm access set statuswould.
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-scriptson the command line during a project-scopednpm install,ci,update, orrebuildis 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.npmrcand environment variables, andnpm ciwill 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:
nullorDate
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. π
bin-links
- 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, orString
The browser that npm commands call when they need to open websites. π
- Set to
falseto suppress browser behavior and print urls to the terminal instead. - Set to
trueto 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:
nullorString(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:
nullorString(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:
trueunless theNO_COLORenviron is set to something other than'0' - Type:
"always"orBoolean 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:
nullorString
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:
Infinityif--allis set; otherwise,0 - Type:
nullorNumber
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 causesnpm diffto ignore the--diff-src-prefixand--diff-dst-prefixconfigs.
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:
nullorPath
Override the temporary directory used by npm patch add to prepare a package for editing. π
editor
- Default: The
EDITORorVISUALenvironment variables, or%SYSTEMROOT%\notepad.exeon 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:
nullorNumber
Tells the command to expect a specific number of results.
This config cannot be used with: expect-results
expect-results
- Default:
null - Type:
nullorBoolean
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:
nullorNumber
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:
nullorPath
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 versioncommand to work on an unclean git repository. - Allow deleting the cache folder with
npm cache clean. - Allow installing packages that have an
enginesdeclaration requiring a different version ofnpm. - Allow installing packages that have an
enginesdeclaration requiring a different version ofnode, even if--engine-strictis enabled. - Allow
npm audit fixto install modules outside your stated dependency range (including SemVer-major changes). - Allow unpublishing all versions of a published package.
- Allow conflicting
peerDependenciesto be installed in the root project. - Implicitly set
--yesduringnpm 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:
falseunless when usingnpm packornpm publishwhere it defaults totrue - 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_modulesfolder, instead of the current working directory. binfiles are linked to{prefix}/bin- man pages are linked to
{prefix}/share/man
Three little consequences, all iconic. β¨
π« global-ignore-file
- Default: The global
--prefixsetting 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
--prefixsetting 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.npmrcand environment variables, and rejected bynpm 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. π
π install-links
- 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 innode_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 setit enables parsing set values withJSON.parse()before saving them to yourpackage.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. π
β οΈ Usinglegacy-peer-depsis not recommended β it won't enforce thepeerDependenciescontract 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:
nullorString
Override the libc of native modules you're installing. The acceptable values are the same as the libc field of package.json. β¨
link
- 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--globalis 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_modulesfolder, 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
_logsinside the cache - Type:
nullor 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:
nullorNumber
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:
nullorString
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-gypbin 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:
nullorString
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_PROXYenvironment 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 theNODE_ENVenvironment 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:
nullorString(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:
nullorString
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:
nullorString
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:
nullorString(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:
nullorString
(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
nodeexecutable is installed. Otherwise, the nearest parent folder containing either apackage.jsonfile or anode_modulesfolder. - 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:
truewhen 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
- Default:
"https://registry.npmjs.org/" - Type: URL
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 theregistryvalue. - 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:
trueunless when usingnpm updatewhere it defaults tofalse - 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:
nullor 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:
nullor 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:
SHELLenvironment 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
- Default:
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
- Default:
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 littlevbefore your version, iconic but changeable π- Default:
"v" - Type:
String
- Default:
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
- Default:
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 fornpm patch updateπ―- Default:
null - Type:
nullorString
- Default:
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:
nullorString
- Default:
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)
- Default:
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:
falseon windows,trueon mac/unix systems with a unicode locale, as defined by theLC_ALL,LC_CTYPE, orLANGenvironment variables. - Type:
Boolean
- Default:
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
- Default:
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
- Default:
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
- Default:
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 ofprocess.platform{arch}- The value ofprocess.arch{workspaces}- Set totrueif theworkspacesorworkspaceoptions are set.{ci}- The value of theci-nameconfig, if set, prefixed withci/, or an empty string ifci-nameis empty.
userconfigβ where your personal settings live π- Default:
"~/.npmrc" - Type:
Path
- Default:
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
- Default:
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
- Default:
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
- Default:
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:
nullorNumber
- Default:
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:
nullorBoolean
- Default:
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_modulestree (install,update, etc.) will link workspaces into thenode_modulesfolder. - Commands that do other things (test,exec,publish, etc.) will operate on the root project, unless one or more workspaces are specified in theworkspaceconfig.
This value is not exported to the environment for child processes.
workspaces-updateβ keep the workspace links fresh π- Default:
true - Type:
Boolean
- Default:
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:
nullorBoolean
- Default:
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=devinstead.
- Default:
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
- Default:
--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.
- Default:
--cache-min=9999 (or bigger) is an alias for --prefer-offline.
certβ your client certificate, legacy era πͺ¦- Default:
null - Type:
nullorString - DEPRECATED:
keyandcertare no longer used for most registry operations. Use registry scopedkeyfileandcertfileinstead. Example://other-registry.tld/:keyfile=/path/to/key.pem//other-registry.tld/:certfile=/path/to/cert.crt
- Default:
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=devinstead.
- Default:
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
- Default:
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-emailinstead.
- Default:
Alias for --init-author-email
init.author.nameβ same but for your name β¨- Default:
"" - Type:
String - DEPRECATED: Use
--init-author-nameinstead.
- Default:
Alias for --init-author-name
init.author.urlβ and your link πΈ- Default:
"" - Type:
""orURL - DEPRECATED: Use
--init-author-urlinstead.
- Default:
Alias for --init-author-url
init.licenseβ dotted license config, ancient relic π- Default:
"" - Type:
String - DEPRECATED: Use
--init-licenseinstead.
- Default:
Alias for --init-license
init.moduleβ the old init module path ποΈ- Default:
"~/.npm-init.js" - Type:
Path - DEPRECATED: Use
--init-moduleinstead.
- Default:
Alias for --init-module
init.versionβ the OG starting version πΌ- Default:
"1.0.0" - Type:
SemVer string - DEPRECATED: Use
--init-versioninstead.
- Default:
Alias for --init-version
keyβ client key, also legacy era πͺ¦- Default:
null - Type:
nullorString - DEPRECATED:
keyandcertare no longer used for most registry operations. Use registry scopedkeyfileandcertfileinstead. Example://other-registry.tld/:keyfile=/path/to/key.pem//other-registry.tld/:certfile=/path/to/cert.crt
- Default:
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
- Default:
nestedβ so instead of hoisting your package installs intonode_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=devto 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:
nullor Boolean - DEPRECATED: use
--omit=optionalto exclude optional dependencies, or--include=optionalto 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:
nullor Boolean - DEPRECATED: use
--omit=devinstead.
Alias for --omit=dev. Short, sweet, and lowkey retired, ngl.
π¦ SEE ALSO π¦
npm help confignpm help npmrcnpm help scriptsnpm help foldersnpm 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
- arch rolling: npm 12.2.1-1 Β· Artistic-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms