Why is npm installing packages from private registry and not from registry.npmjs.org

Viewed 2377

I have create a .nmprc file in my project directory as:

@mycompany:registry=https://registry.mycompany.com/

However when I do npm install I see package dependencies which do not start with @mycompany also gets installed from https://registry.mycompany.com/ and not from https://registry.npmjs.org/.

This is what I see in package-lock.json:

"yaml": {
  "version": "1.7.2",
  "resolved": "https://registry.mycompany.com/yaml/-/yaml-1.7.2.tgz",
  "integrity": "sha512-qXROVp90sb83XtAoqE8bP9RwAkTTZbugRUTm5YeFCBfNRPEp2YzTeqWiz7m5OORHzEvrA/qcGS8hp/E+MMROYw==",
  "dev": true,
  "requires": {
    "@babel/runtime": "^7.6.3"
   }
1 Answers

Since you're using an .npmrc File, the command npm install will try to find all packages in your companies registry https://registry.mycompany.com/

If you want to install all the other Packages you need to update your .npmrc File as followed.

Your Current .npmrc File:

@mycompany:registry=https://registry.mycompany.com/

Updated Version

@mycompany:registry=https://registry.mycompany.com/

registry=https://registry.npmjs.org

If you run npm install it will install all Packages with the @mycompany FLag from your companies Registry and it will try to install all other packages from the public npm Registry.

Related