21

After running yarn config set registry https://registry.yarnpkg.com/, Yarn continuously uses the wrong registry--in this case, https://registry.npmjs.org/.

Here is the output from yarn config list:

yarn config v1.13.0
info yarn config
{ 'version-tag-prefix': 'v',
  'version-git-tag': true,
  'version-commit-hooks': true,
  'version-git-sign': false,
  'version-git-message': 'v%s',
  'init-version': '1.0.0',
  'init-license': 'MIT',
  'save-prefix': '^',
  'bin-links': true,
  'ignore-scripts': false,
  'ignore-optional': false,
  registry: 'https://registry.yarnpkg.com/',
  'strict-ssl': true,
  'user-agent': 'yarn/1.13.0 npm/? node/v8.11.4 linux x64',
  lastUpdateCheck: 1552699471443 }
info npm config
{ 'strict-ssl': false,
  ca: '',
  registry: 'https://registry.yarnpkg.com/' }

As you can see from the output, I also ran npm config set registry ttps://registry.yarnpkg.com/ to avoid mix ups. I also checked the .npmrc and .yarnrc files for the any references to the npmjs registry.

***Edit: Also, deleted both the package-lock.json and the yarn.lock files before running yarn install. But still the npmjs registry is listed in the new yarn.lock file. It's not using the yarnpkg registry at all.

How can I force Yarn to use a specific registry?

tk421
  • 5,775
  • 6
  • 23
  • 34
navig8tr
  • 1,724
  • 8
  • 31
  • 69

2 Answers2

6

Remove yarn.lock, package-lock.json, all node_modules, .yarnrc and run: yarn cache clean && yarn install.

If that doesn't work, remove all again and run: yarn cache clean && yarn install --registry https://registry.yarnpkg.com/.

Stav Alfi
  • 13,139
  • 23
  • 99
  • 171
2

For me, there was a conflict with my user .npmrc. I deleted this file (in C:\Users\{username}) and configured the .npmrc within the root of my project instead.

geisterfurz007
  • 5,292
  • 5
  • 33
  • 54
  • It is unintuitive, to say the least, that yarn uses the user-level `.npmrc` over the project-level `.yarnrn`. If "fixed" it by adding a project-level `.npmrc` so that I don't have to mess with my overall npm configuration. – Martin J.H. Nov 09 '22 at 12:27