kgangadhar
kgangadhar

Reputation: 5088

what's the difference between "npm install" and "npm --userconfig=./.npmrccorp i "

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

Answers (2)

Pankaj
Pankaj

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.jsonwhile 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 also

Upvotes: 8

Clarence Leung
Clarence Leung

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

Related Questions