If you have both Nodejs and npm installed correctly, just open your terminal:
Run: npm config ls -l
to see a set of configuration parameters that are internal to npm.
npm is configured from the following sources, sorted by priority:
- Command Line Flags:
--save-dev, --prefix, --global
- Environment Variables:
npm_config_foo=bar
or NPM_CONFIG_FOO=bar
- Both are correct values but just know that inside npm-scripts npm will set its own environment variables and Node will prefer those lowercase versions over any uppercase ones you set.
- Also you need to use underscores instead of dashes, so
--allow-same-version
would be npm_config_allow_same_version=true
- npmrc Files: There are four relevant files:
- per-project:
/path/to/my/project/.npmrc
- per-user defaults to:(
$HOME/.npmrc
; also configurable via CLI option --userconfig
or environment variable $NPM_CONFIG_USERCONFIG
)
- global defaults to:(
$PREFIX/etc/npmrc
; also configurable via CLI option --globalconfig
or environment variable $NPM_CONFIG_GLOBALCONFIG
)
- npm built-in configuration file: (
/path/to/npm/npmrc
)
For those who may be unfamiliar or new to Nodejs, npm and nvm the user needs to be aware that it's possible to have more then one version of Node on your system.
It's also possible to have Node stored both locally and globally.
With multiple versions and different locations it's possible that $ which node
may not give you the right location and if you run $ locate node
your gonna end up with too many locations to sort through.
Using the built-in Node/npm tools to locate Node seems to make the most sense.