纱线不会使用指定的注册表

nav*_*8tr 13 npm yarnpkg

运行后yarn config set registry https://registry.yarnpkg.com/,Yarn 不断使用错误的注册表——在这种情况下,是https://registry.npmjs.org/

这是来自的输出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/' }
Run Code Online (Sandbox Code Playgroud)

正如你从输出中看到的,我也跑来npm config set registry ttps://registry.yarnpkg.com/避免混淆。我还检查了 .npmrc 和 .yarnrc 文件中是否有对 npmjs 注册表的任何引用。

***编辑:另外,在运行之前删除了 package-lock.json 和 yarn.lock 文件yarn install。但是 npmjs 注册表仍然列在新的 yarn.lock 文件中。它根本不使用 yarnpkg 注册表。

如何强制 Yarn 使用特定的注册表?

Sta*_*lfi 6

删除yarn.lock、package-lock.json、所有node_modules、.yarnrc并运行yarn cache clean && yarn install

如果这不起作用,请再次删除所有内容并运行:yarn cache clean && yarn install --registry https://registry.yarnpkg.com/

  • 删除`yarn.lock`文件就可以了 (3认同)