npm-config
Manage npm configuration options
TLDR
Show all configuration settings
List all configuration settings as JSON
Get the value of a specific configuration key
Set a configuration key to a specific value
Delete a configuration key
Edit the global npm configuration file in the default editor
Attempt to repair invalid configuration items
SYNOPSIS
npm config get [
npm config set
npm config delete
npm config list
npm config edit
npm config cache
PARAMETERS
get [
Gets the value of the specified configuration key. If no key is specified, it will display all keys.
set
Sets the value of the specified configuration key. This will override any existing value.
delete
Deletes the specified configuration key from the configuration file.
list
Lists all npm configuration settings.
edit
Opens the configuration file in the default editor for manual editing.
cache
Manage the npm cache (used rarely now)
-g, --global
Operates on the global npm configuration rather than the local project configuration.
--location=global
Operates on the global npm configuration rather than the local project configuration.
--location=project
Operates on the local project configuration.
--json
Output results in JSON format.
DESCRIPTION
The `npm config` command is used to manage npm's configuration settings. It allows you to view, set, and delete npm configuration options. These configuration options affect how npm installs packages, resolves dependencies, and performs other operations. The command is invaluable for tailoring npm's behavior to your specific project needs or development environment. You can set configurations globally (affecting all projects) or locally (affecting only the current project).
Configurations stored in different locations override each other based on priority, from command-line arguments to npm defaults. Understanding configuration is essential for efficient npm usage and consistent project builds across different systems.
CAVEATS
Modifying the global configuration can impact all projects on your system. Be mindful of the scope when setting configuration values.
CONFIGURATION FILES
npm reads configuration settings from several locations in order of priority:
1. Command line flags.
2. Environment variables.
3. Project .npmrc file.
4. User .npmrc file (~/.npmrc).
5. Global npmrc file (prefix/etc/npmrc).
6. npm's built-in defaults.
SEE ALSO
npm(1), npm-install(1), npmrc(5)