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

Viewed 4554

I have a mono repo in Azure DevOps that contains JavaScript packages. I use lerna for managing packages and yarn as package manager. I'm new to Azure DevOps artifacts and I want to setup yarn to be a upstream feed. I have read Use npm to store JavaScript packages in Azure DevOps Services or TFS and followed the steps. With npm seems everything works fine and after I enter npm i in my project I can see packages that sourced npm in azure artifact. But if I use yarn nothing happens. Can somebody help me?

Project .npmrc:

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

always-auth=true

Global .npmrc in %HOMEPATH%\.npmrc

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

I also go to feed settings and add yarn registry as new public upstream source and move it up to be 1st upstream source. but if I enter yarn install in my project and then go to Azure artifacts and filter artifacts by source yarn nothing shown.

azure devops feed settings

npm ping with that .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\_logs\2020-03-27T03_20_26_797Z-debug.log

npm ping in somewhere else:

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

I deleted Yarn cache folder in %LOCALAPPDATA%\Yarn\Cacheand also yarn.lock file and node_modules folder in my project root and then reinstalled packages. I think problem was due to yarn.lock file. Because in yarn.lock file for each package specified registry and because I haven't package-lock.json npm works and yarn doesn't. You can see before I delete yarn.lock file and after I reinstall package in image blow:

yarn.lock file changed registry

Related