NPM-CONFIG(1)

πŸ’… npm-config β€” bestie's guide to the npm config files πŸ‘‘

okay so this is npm-config from the npm manual, and we're gonna get you so comfy with it. it's the whole "manage the npm configuration files" situation. let's go ✨


πŸŽ€ Synopsis

npm config set <key>=<value> [<key>=<value> ...]
npm config get [<key> [<key> ...]]
npm config delete <key> [<key> ...]
npm config list [--json]
npm config edit
npm config fix

alias: c
🫢 heads up bestie: this command is unaware of workspaces. like, it literally does not know they exist. no cap.

🌸 Description

so like, where does npm even get its config from? iconic question. npm pulls its settings from:

  • the command line
  • environment variables
  • npmrc files
  • and in some cases, the package.json file

for the whole tea on npmrc files, run npm help npmrc.

and if you want a much more thorough explanation of the mechanisms in play plus a full list of every config option available β†’ npm help config. it's giving encyclopedia. πŸ’–

the npm config command is your girl for updating and editing the contents of the user and global npmrc files. main character energy fr.


⭐ Sub-commands

Config supports these sub-commands, and each one ate:

πŸ“ set

npm config set key=value [key=value...]
npm set key=value [key=value...]

sets each of the config keys to the value you provided. it modifies the user configuration file unless location ⟨/commands/npm-config#location⟩ is passed. (iykyk πŸ‘€)

if the value is omitted, the key gets removed from your config file entirely. gone. poof. no trace. πŸ’€

note: for backwards compatibility, npm config set key value is supported as an alias for npm config set key=value. so both work, bestie.

πŸ¦‹ get

npm config get [key ...]
npm get [key ...]

echoes the config value(s) to stdout. that's it, that's the vibe.

if you pass multiple keys, the values get prefixed with the key names so you can tell which is which. bless.

if you pass no keys at all, this command behaves the same as npm config list. literally the same thing. πŸ’…

🌈 list

npm config list

shows all the config settings. use -l to also show the defaults. use --json to show the settings in json format. cute and structured, we love.

🧚 delete

npm config delete key [key ...]

deletes the specified keys from all configuration files. all of them. every single one. 😭

πŸ’œ edit

npm config edit

opens the config file in an editor. use the --global flag to edit the global config instead. (editor pick is a whole thing β€” see the editor config down below ⬇️)

🌸 fix

npm config fix

attempts to repair invalid configuration items. usually this means attaching authentication config (i.e. _auth, _authToken) to the configured registry. it's like a little glow-up for your broken config ✨


πŸ‘‘ Configuration

πŸŽ€ json

  • Default: false
  • Type: Boolean

whether or not to output JSON data instead of 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. so like, don't come for me if one of them doesn't do it πŸ™ˆ

🌟 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

πŸ¦‹ 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. pick your fighter πŸ’…

πŸ’– location

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

when passed to npm config this refers to which config file to use. yes, which file. that's the whole point.

when set to "global" mode, packages are 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

(yes bestie, these bullets are the same as global up there β€” they're supposed to be. don't @ me, that's just what the page says 🫢)

🌈 long

  • Default: false
  • Type: Boolean

show extended information in ls, search, and help-search. more info, more slay.


⭐ See Also

  • npm help folders
  • npm help config
  • package.json ⟨/configuring-npm/package-json⟩
  • npm help npmrc
  • npm help npm

okay that's the whole thing and you ATE it. go forth and config with confidence, bestie πŸ’œπŸ¦‹βœ¨

with love from NPM@12.2.1 Β· October 2026 Β· NPM-CONFIG(1) πŸŒΈπŸŽ€πŸ’…

πŸ“¦ where this page comes from