Reputation: 5088
I want to know what the difference is between these two commands in nodejs
npm install
and,
npm --userconfig=./.npmrccorp i
As far as I know, both will install the required node modules specified in the package.json
.
Upvotes: 3
Views: 4949
Reputation: 966
Both are different
npm install
: This is the install modules mentioned in package.json
while considering the configuration file from your home directory i.e. ~/.npmrc
. This is same as npm i
npm --userconfig=./.npmrccorp i
: This will install the modules as mentioned in package.json
while considering the configuration file supplied by the --userconfig
argument. The last i
and install
are interchangeable. This can be rewritten as npm --userconfig=./.npmrccorp install
alsoUpvotes: 8
Reputation: 2556
One uses npm with the regular default settings, the other uses npm with the settings defined in the file ./.npmrccorp
.
An example common use case for this is if you work at a company that has its own npm registry.
The settings in ./.npmrccorp
will fetch npm modules from your company's private npm registry, but the default settings would fetch modules from the default one at registry.npmjs.org
.
Upvotes: 1