npm config file locations
Commands use a POSIX shell (macOS, Linux, or WSL). Install the named editor or CLI first. Before using an environment-variable path, check that the variable is set to a non-empty, intended path. When using vi or Notepad, ensure the parent directory exists and is writable. A missing file is created when you save it; Notepad may ask to create it.
This page shows npmrc file precedence: Project, User, Global, then Builtin. Command-line options override environment variables, and environment variables override npmrc files. Project .npmrc is not read in global mode, such as npm install -g. Paths are installation-dependent templates, not detected files.
Project level
Highest file priorityRun commands from the project root (the directory containing package.json). Applies only to this project; not read in global mode (for example, npm install -g).
Config file location
<project>/.npmrcCommands
vi .npmrcUser level
Second priorityApplies to your user account.
Config file location
~/.npmrcCommands
vi ~/.npmrcGlobal level
Third priorityApplies to every user of this npm installation.
Config file location
$PREFIX/etc/npmrcCommands
npm config edit --location=globalBuiltin level
Lowest file priorityBundled with npm so distribution maintainers can provide default configuration. Normally not edited by users.
Config file location
Replace <npm installation> with the directory containing npm itself, not the Node.js installation prefix. The exact path depends on how npm was installed.<npm installation>/npmrc
Official npm documentation