Here are the relevant docs on the subject:
https://docs.npmjs.com/cli/config
It looks like these are equivalent:
npm config set foo bar
npm set -g foo bar
so I figured that if I run npm set
without the -g switch, then it would update my local .npmrc file:
npm set foo bar
but npm set
w/o the -g flag did not update my local .npmrc file. So what the hell is the difference between npm set
and npm config set
, and what is the -g flag for?
There are 4 npmrc files used by npm (ref: https://docs.npmjs.com/files/npmrc.html).
They are modified this way:
There does not seem to be a standard way (a command) for setting values to the per-project config file. I think you have to edit with a text editor.
You use the
npm [config] set
command to set per-user values.You use the
npm [config] set -g
command to set global values.You don't need to edit the build in version
Use the first method in your case.
Please note that each of these files is loaded, and config options are resolved in priority order. For example, a setting in the userconfig file would override the setting in the globalconfig file.