How to use multiple npm registries in Yarn?

I am trying to customize 0.17.9 yarn in our environment, but I have a problem with our registry. We currently use two registries, official npmjs and our own registry on the internal network (Sinopia).

The problem is that we are using an internal tool to transfer packages from one or the other using the -registry flag via npm install . yarn add does not have the -registry option, and I cannot install a custom registry all over the world using backup on npmjs. I tried .npmrc , but it installs only one registry for npm / yarn in the project. .yarnrc does not seem to work and disabled .npmrc

Is it possible to specify two registers (backup second registry, if the package is not found in the first)? Or point a different npm registry to the package?

+7
javascript npm yarnpkg
source share
2 answers

Yarn does not support the -registry flag like npm, but you can configure your registry in .yarnrc

If your .yarnrc is ignored, you can copy it from ~ / .yarnrc using:

 yarn config set registry http://registry.com/registry// 
+3
source share

@kraklin you can use the .yarnrc file in the root of the project and write this line to this file.

registry " https://registry.npmjs.org/ "

This will act as a project specific repository. Check it out, I use it.

0
source share

All Articles