0

We are migrating from Yarn 1+ to Yarn 2+ (3.2.1) to manage our project dependencies. Most of our private packages are in github but couple of open-sourceed packages are in npm.

When we migrate to Yarn 2+, we created .yarnrc.yml file to list the scope and auth token. Yarn2 fetches the private packages fine after the config but it fails to fetch scoped open-sourced packages as they are in npm.

How do we configure Yarn2 to say, all @company scoped packages are in github except for @company/package1 package which is in npm?

metasync
  • 338
  • 1
  • 10

1 Answers1

0

Struggling with the exact same scenario.

What worked for me is to add resolutions in package.json for every private packages like this

"resolutions": {
  "@scope/some-private-pkg": "npm:@scope/some-private-pkg@1.0.0-beta.10",
  "@scope/another": "npm:@scope/another@1.4.0"
}

See https://github.com/yarnpkg/berry/issues/1621#issuecomment-669136172

To be honest, I'm not sure to understand the logic and why we still need this kind of workaround with current stable version of yarn (v3.2.3)

Ricovitch
  • 2,278
  • 1
  • 21
  • 28
  • Agree with you, this would not be an unusual scenario with many big companies and yarn doesn't support this without workarounds. Thank you for the answer. Will try it out and see if it works. – metasync Sep 19 '22 at 15:32