npmrc - The npm config files Description npm gets its config settings from the command line, environment vari- ables, and npmrc files. The npm config command can be used to update and edit the contents of the user and global npmrc files. For a list of available configuration options, see npm help config. Files The four relevant files are: o per-project config file (/path/to/my/project/.npmrc) o per-user config file (~/.npmrc) o global config file ($PREFIX/etc/npmrc) o npm builtin config file (/path/to/npm/npmrc) All npm config files are an ini-formatted list of key = value parame- ters. Environment variables can be replaced using ${VARIABLE_NAME}. For example: prefix = ${HOME}/.npm-packages Each of these files is loaded, and config options are resolved in pri- ority order. For example, a setting in the userconfig file would over- ride the setting in the globalconfig file. Array values are specified by adding "[]" after the key name. For exam- ple: key[] = "first value" key[] = "second value" Comments Lines in .npmrc files are interpreted as comments when they begin with a ; or # character. .npmrc files are parsed by npm/ini https://github.com/npm/ini, which specifies this comment syntax. For example: # last modified: 01 Jan 2016 ; Set a new registry for a scoped package @myscope:registry=https://mycustomregistry.example.org Per-project config file When working locally in a project, a .npmrc file in the root of the project (ie, a sibling of node_modules and package.json) will set con- fig values specific to this project. Note that this only applies to the root of the project that you're run- ning npm in. It has no effect when your module is published. For example, you can't publish a module that forces itself to install glob- ally, or in a different location. Additionally, this file is not read in global mode, such as when run- ning npm install -g. Per-user config file $HOME/.npmrc (or the userconfig param, if set in the environment or on the command line) Global config file $PREFIX/etc/npmrc (or the globalconfig param, if set above): This file is an ini-file formatted list of key = value parameters. Environment variables can be replaced as above. Built-in config file path/to/npm/itself/npmrc This is an unchangeable "builtin" configuration file that npm keeps consistent across updates. Set fields in here using the ./configure script that comes with npm. This is primarily for distribution main- tainers to override default configs in a standard and consistent man- ner. See also o npm help folders o npm help config o npm help config o npm help package.json o npm help npm
Please see following description for synopsis
NPMRC(5) NPMRC(5)
NAME
npmrc - The npm config files
Description
npm gets its config settings from the command line, environment vari-
ables, and npmrc files.
The npm config command can be used to update and edit the contents of
the user and global npmrc files.
For a list of available configuration options, see npm help config.
Files
The four relevant files are:
o per-project config file (/path/to/my/project/.npmrc)
o per-user config file (~/.npmrc)
o global config file ($PREFIX/etc/npmrc)
o npm builtin config file (/path/to/npm/npmrc)
All npm config files are an ini-formatted list of key = value parame-
ters. Environment variables can be replaced using ${VARIABLE_NAME}.
For example:
prefix = ${HOME}/.npm-packages
Each of these files is loaded, and config options are resolved in pri-
ority order. For example, a setting in the userconfig file would over-
ride the setting in the globalconfig file.
Array values are specified by adding "[]" after the key name. For exam-
ple:
key[] = "first value"
key[] = "second value"
Comments
Lines in .npmrc files are interpreted as comments when they begin with
a ; or # character. .npmrc files are parsed by npm/ini
https://github.com/npm/ini, which specifies this comment syntax.
For example:
# last modified: 01 Jan 2016
; Set a new registry for a scoped package
@myscope:registry=https://mycustomregistry.example.org
Per-project config file
When working locally in a project, a .npmrc file in the root of the
project (ie, a sibling of node_modules and package.json) will set con-
fig values specific to this project.
Note that this only applies to the root of the project that you're run-
ning npm in. It has no effect when your module is published. For
example, you can't publish a module that forces itself to install glob-
ally, or in a different location.
Additionally, this file is not read in global mode, such as when run-
ning npm install -g.
Per-user config file
$HOME/.npmrc (or the userconfig param, if set in the environment or on
the command line)
Global config file
$PREFIX/etc/npmrc (or the globalconfig param, if set above): This file
is an ini-file formatted list of key = value parameters. Environment
variables can be replaced as above.
Built-in config file
path/to/npm/itself/npmrc
This is an unchangeable "builtin" configuration file that npm keeps
consistent across updates. Set fields in here using the ./configure
script that comes with npm. This is primarily for distribution main-
tainers to override default configs in a standard and consistent man-
ner.
See also
o npm help folders
o npm help config
o npm help config
o npm help package.json
o npm help npm
ATTRIBUTES
See attributes(7) for descriptions of the following attributes:
+---------------+--------------------------+
|ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+---------------+--------------------------+
|Availability | runtime/nodejs/nodejs-18 |
+---------------+--------------------------+
|Stability | Pass-thru volatile |
+---------------+--------------------------+
NOTES
Source code for open source software components in Oracle Solaris can
be found at https://www.oracle.com/downloads/opensource/solaris-source-
code-downloads.html.
This software was built from source available at
https://github.com/oracle/solaris-userland. The original community
source was downloaded from https://github.com/nodejs/node/ar-
chive/v18.1.0.zip.
Further information about this software can be found on the open source
community website at https://github.com/nodejs/node.
April 2022 NPMRC(5)