Search code examples
npmartifactory

Is it possible to have two private registries with different authentication data in .npmrc?


There is an npm package on artifactory_1 which is private. This means that the _auth property in .npmrc contains the authentication data for artifactory_1 in base64 and always-auth is set to true. This way the npm install works, the private package can be downloaded from artifactory_1 because the authentication data is provided from the _auth property.

Now I have an other private package on an other private artifactory (may it be artifactory_2). I want to use the private package of artifactory_2 in the same project, where artifactory_1 is already configured with its authentication data. This means, that I should somehow add the new registry and the authentication data of it to the .npmrc. It should be possible to use the private package from artifactory_1 and the private package from artifactory_2 at the same time.

It is documented here, how is it possible to handle one private package in a project. But I do not find any documentation/example for more private packages from different artifactories.

Any idea how should this be done? Is this even possible, what I want to do?


Solution

  • I did not make it to use repos from two different artifactories. I migrated the content of the first artifactory into a repo of the second artifactory. After that I was able to create a virtual repository, that showed the content of the two repos as one. This virtual repo is set up in my project as registry and this way I'm able to install the content of the two repos.