![]() ![]() Npm ls -global -parseable -long -loglevel info If multiple single-character shorthands are strung together, and the resulting combination is unambiguously not some other configuration param, then it is expanded to its various component pieces. If the specified configuration param resolves unambiguously to a known configuration parameter, then it is expanded to that configuration parameter. The following shorthands are parsed on the command-line: -v: -version Run npm config ls -l to see a set of configuration parameters that are internal to npm, and are defaults if nothing else is specified. Npm's built-in configuration file (/path/to/npm/npmrc) Global configuration file (defaults to $PREFIX/etc/npmrc configurable via CLI option -globalconfig or environment variable $NPM_CONFIG_GLOBALCONFIG) Per-user configuration file (defaults to $HOME/.npmrc configurable via CLI option -userconfig or environment variable $NPM_CONFIG_USERCONFIG) The four relevant files are: per-project configuration file (/path/to/my/project/.npmrc) ![]() Notice that you need to use underscores instead of dashes, so -allow-same-version would become npm_config_allow_same_version=true. ![]() However, please note that inside npm-scripts npm will set its own environment variables and Node will prefer those lowercase versions over any uppercase ones that you might set. Config values are case-insensitive, so NPM_CONFIG_FOO=bar will work the same. ![]() Any environment configurations that are not given a value will be given the value of true. For example, putting npm_config_foo=bar in your environment will set the foo configuration parameter to bar. Finally, -flag1 -flag2 – bar will set both configuration parameters to true, and the bar is taken as a command argument.Īny environment variables that start with npm_config_ will be interpreted as a configuration parameter. Using -flag without specifying any value will set the value to true.Įxample: -flag1 -flag2 will set both configuration parameters to true, while -flag1 -flag2 bar will set flag1 to true, and flag2 to bar. A – argument tells the cli parser to stop reading flags. Putting -foo bar on the command line sets the foo configuration parameter to “bar”. Npm gets its configuration values from the following sources, sorted by priority: More than you probably want to know about npm configuration ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |