如何将 Yarn 注册表用作 Azure DevOps 工件上游源?

How to use Yarn registry as Azure DevOps artifact upstream feed?

我在 Azure DevOps 中有一个单存储库,其中包含 JavaScript 个包。我使用 lerna 来管理包和 yarn 作为包管理器。我是 Azure DevOps 工件的新手,我想将 yarn 设置为上游源。我已阅读 Use npm to store JavaScript packages in Azure DevOps Services or TFS 并按照步骤操作。使用 npm 似乎一切正常,在我的项目中输入 npm i 后,我可以在 azure artifact 中看到源自 npm 的包。但是如果我使用纱线,什么也不会发生。有人可以帮助我吗?

项目 .npmrc:

registry=https://pkgs.dev.azure.com/<OrganizationName>/_packaging/<OrganizationName>/npm/registry/

always-auth=true

全球 .npmrc %HOMEPATH%\.npmrc

//pkgs.dev.azure.com/<OrganizationName>/_packaging/<OrganizationName>/npm/registry/:_authToken=blahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblah

我还转到 feed 设置并将 yarn registry 添加为新的 public 上游源并将其上移为第一个上游源。但是如果我在我的项目中输入 yarn install 然后转到 Azure artifacts 并按 source yarn filter artifacts nothing showed.

npm ping 那个 .npmrcs:

path\to\project's\package.json>npm ping
npm notice PING https://pkgs.dev.azure.com/<OrganizationName>/_packaging/<OrganizationName>/npm/registry/
npm ERR! code E404
npm ERR! 404 Not Found - GET https://pkgs.dev.azure.com/<OrganizationName>/_packaging/<OrganizationName>/npm/registry/-/ping?write=true
npm ERR! 404
npm ERR! 404  'ping' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\<UserName>\AppData\Roaming\npm-cache\_logs20-03-27T03_20_26_797Z-debug.log

npm ping 在其他地方:

C:\WINDOWS\system32>npm ping
npm notice PING https://registry.npmjs.org/
npm notice PONG 1.296ms

我删除了 %LOCALAPPDATA%\Yarn\Cache 中的 Yarn 缓存文件夹以及项目根目录中的 yarn.lock 文件和 node_modules 文件夹,然后重新安装了包。我认为问题是由于 yarn.lock 文件引起的。因为在 yarn.lock 文件中为每个包指定了注册表,而且因为我没有 package-lock.json npm 工作而 yarn 不工作。 你可以看到我删除 yarn.lock 文件之前和我重新安装包之后的图像: