Error installing yarn 3 (according to Plone install docs)

I'm following the steps listed in Install Plone from its packages – Install — Plone Documentation v6.0 but get this error:

$ npm install yarn@3
npm ERR! code ETARGET
npm ERR! notarget No matching version found for yarn@3.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ubuntu/.npm/_logs/2023-08-06T14_28_15_136Z-debug-0.log

That log file has a bit more detail:

48 verbose stack yarn: No matching version found for yarn@3.
48 verbose stack     at module.exports (/home/ubuntu/.nvm/versions/node/v16.20.1/lib/node_modules/npm
/node_modules/npm-pick-manifest/lib/index.js:209:23)
48 verbose stack     at RegistryFetcher.manifest (/home/ubuntu/.nvm/versions/node/v16.20.1/lib/node_m
odules/npm/node_modules/pacote/lib/registry.js:125:22)
48 verbose stack     at async Arborist.[nodeFromEdge] (/home/ubuntu/.nvm/versions/node/v16.20.1/lib/n
ode_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1061:19)
48 verbose stack     at async Arborist.[buildDepStep] (/home/ubuntu/.nvm/versions/node/v16.20.1/lib/n
ode_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:930:11)
48 verbose stack     at async Arborist.buildIdealTree (/home/ubuntu/.nvm/versions/node/v16.20.1/lib/n
ode_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:211:7)
48 verbose stack     at async Promise.all (index 1)
48 verbose stack     at async Arborist.reify (/home/ubuntu/.nvm/versions/node/v16.20.1/lib/node_modul
es/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:154:5)
48 verbose stack     at async Install.exec (/home/ubuntu/.nvm/versions/node/v16.20.1/lib/node_modules
/npm/lib/commands/install.js:145:5)
48 verbose stack     at async module.exports (/home/ubuntu/.nvm/versions/node/v16.20.1/lib/node_modul
es/npm/lib/cli.js:78:5)

yarn "classic" is fine, as it would pick up its v3 implementation when you generate a new volto project. https://github.com/plone/volto/tree/98738972975ee6f74c29b05899fd261874a071de/packages/generator-volto/generators/app/templates/.yarn

Try with npm install yarn

I'm not familiar with this error. I searched for it and found a suggestion to run npm cache clean --force

Thank you!

% npm install yarn

added 1 package, and audited 2 packages in 335ms

found 0 vulnerabilities
% yarn -v
1.22.19

I did not continue with this, because I found these yarn installation instructions which led me to try this, which got version 3 installed:

% yarn set version stable
warning package.json: No license field
➤ YN0000: Retrieving https://repo.yarnpkg.com/3.6.3/packages/yarnpkg-cli/bin/yarn.js
➤ YN0000: Saving the new release in .yarn/releases/yarn-3.6.3.cjs
➤ YN0000: Done in 0s 326ms
% yarn set version 3
➤ YN0000: Retrieving https://repo.yarnpkg.com/3.6.3/packages/yarnpkg-cli/bin/yarn.js
➤ YN0000: Saving the new release in .yarn/releases/yarn-3.6.3.cjs
➤ YN0000: Done in 0s 286ms
% yarn install
➤ YN0000: ┌ Resolution step
➤ YN0000: └ Completed in 0s 409ms
➤ YN0000: ┌ Fetch step
➤ YN0013: │ yarn@npm:1.22.19 can't be found in the cache and will be fetched from the remote registry
➤ YN0000: └ Completed in 0s 835ms
➤ YN0000: ┌ Link step
➤ YN0031: │ One or more node_modules have been detected and will be removed. This operation may take some time.
➤ YN0007: │ yarn@npm:1.22.19 must be built because it never has been before or the last one failed
➤ YN0000: └ Completed in 0s 451ms
➤ YN0000: Done with warnings in 1s 700ms
% yarn -v
3.6.3

Hm, that did not work for me:

% npm cache clean --force
npm WARN using --force Recommended protections disabled.
% npm install yarn@3
npm ERR! code ETARGET
npm ERR! notarget No matching version found for yarn@3.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.

I'm confident that npm install yarn@3 worked for me about two weeks ago.
It isn't working now.

Okay this works for installing yarn 3 and is the way mentioned in the most updated version of the docs:

curl -o- -L https://yarnpkg.com/install.sh | bash

see: Getting Started – Frontend – Introduction — Plone Documentation v6.0