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
2 Likes

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

Confirming that this worked for me on macOS Ventrua 13.6.

I was also successful with:

npm install yarn -g
yarn set version stable

But what happens when stable is 4?

Here are options.

I assume that this would work.

yarn set version 3.x

Fair enough :+1:
shoulda read that fine manual :slight_smile:

Fixed in https://github.com/plone/documentation/pull/1540

This does not work on my system.

claus@dev12 ~ $ npm install -g yarn

added 1 package, and audited 2 packages in 1s

found 0 vulnerabilities
claus@dev12 ~ $ yarn set version 3.x
warning package.json: No license field
Resolving 3.x to a url...
error An unexpected error occurred: "Release not found: 3.x".
info If you think this is a bug, please open a bug report with the information provided in "/srv/data/home/claus/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/policies for documentation about this command.

Instead following commands worked

claus@dev12 ~ $ corepack prepare yarn@3.6.3 --activate
Preparing yarn@3.6.3 for immediate activation...
claus@dev12 ~ $ yarn set version 3.6.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 797ms
claus@dev12 ~ $ yarn -v
3.6.3

And finally i identified only yarn set version 3.x is the issue, using a full version works without any other of the commands i posted.

Try:

yarn set version stable

1 Like

Actually don't, because yarn 4.0 is out, so try instead:

yarn set version 3

Then

yarn --version

should show you 3.6.4

1 Like

had intitially the same issue with just npm install yarn@3

This worked for me today on macOS Ventura from the instructions above:

yarn set version stable

# gave
➤ YN0000: Retrieving https://repo.yarnpkg.com/4.0.2/packages/yarnpkg-cli/bin/yarn.js
➤ YN0000: Saving the new release in .yarn/releases/yarn-4.0.2.cjs

# then
yarn set version 3
npm install yarn

tada!

yarn -v

# output
3.7.0

I am now successfully on version 3.7.0 !

1 Like

Yes, it worked.

If you get the following error:
Error: Cannot find module '.../.yarn/releases/yarn-3.4.1.cjs' or similar
look for a .yarnrc.yml file and delete it