1 .TH "NPMRC" "5" "October 2016" "" ""
3 \fBnpmrc\fR \- The npm config files
6 npm gets its config settings from the command line, environment
7 variables, and \fBnpmrc\fP files\.
9 The \fBnpm config\fP command can be used to update and edit the contents
10 of the user and global npmrc files\.
12 For a list of available configuration options, see npm help 7 config\.
15 The four relevant files are:
18 per\-project config file (/path/to/my/project/\.npmrc)
20 per\-user config file (~/\.npmrc)
22 global config file ($PREFIX/etc/npmrc)
24 npm builtin config file (/path/to/npm/npmrc)
28 All npm config files are an ini\-formatted list of \fBkey = value\fP
29 parameters\. Environment variables can be replaced using
30 \fB${VARIABLE_NAME}\fP\|\. For example:
34 prefix = ${HOME}/\.npm\-packages
38 Each of these files is loaded, and config options are resolved in
39 priority order\. For example, a setting in the userconfig file would
40 override the setting in the globalconfig file\.
42 Array values are specified by adding "[]" after the key name\. For
48 key[] = "second value"
52 \fBNOTE:\fR Because local (per\-project or per\-user) \fB\|\.npmrc\fP files can contain
53 sensitive credentials, they must be readable and writable \fIonly\fR by your user
54 account (i\.e\. must have a mode of \fB0600\fP), otherwise they \fIwill be ignored by
58 Lines in \fB\|\.npmrc\fP files are interpreted as comments when they begin with a \fB;\fP or \fB#\fP character\. \fB\|\.npmrc\fP files are parsed by npm/ini \fIhttps://github\.com/npm/ini\fR, which specifies this comment syntax\.
64 # last modified: 01 Jan 2016
65 ; Set a new registry for a scoped package
66 @myscope:registry=https://mycustomregistry\.example\.org
69 .SS Per\-project config file
71 When working locally in a project, a \fB\|\.npmrc\fP file in the root of the
72 project (ie, a sibling of \fBnode_modules\fP and \fBpackage\.json\fP) will set
73 config values specific to this project\.
75 Note that this only applies to the root of the project that you're
76 running npm in\. It has no effect when your module is published\. For
77 example, you can't publish a module that forces itself to install
78 globally, or in a different location\.
80 Additionally, this file is not read in global mode, such as when running
81 \fBnpm install \-g\fP\|\.
82 .SS Per\-user config file
84 \fB$HOME/\.npmrc\fP (or the \fBuserconfig\fP param, if set in the environment
85 or on the command line)
86 .SS Global config file
88 \fB$PREFIX/etc/npmrc\fP (or the \fBglobalconfig\fP param, if set above):
89 This file is an ini\-file formatted list of \fBkey = value\fP parameters\.
90 Environment variables can be replaced as above\.
91 .SS Built\-in config file
93 \fBpath/to/npm/itself/npmrc\fP
95 This is an unchangeable "builtin" configuration file that npm keeps
96 consistent across updates\. Set fields in here using the \fB\|\./configure\fP
97 script that comes with npm\. This is primarily for distribution
98 maintainers to override default configs in a standard and consistent
109 npm help 5 package\.json