I've cloned a project which uses Yarn 1.x and am trying to run it, but I can't find a way to get the right version of Yarn. I think I must be missing something.
Commented Terminal session:
# using node16.18.0
$ nvm use v16
Now using node v16.18.0 (npm v8.19.2)
# start with no yarn installed
$ yarn --version
zsh: command not found: yarn
# package.json has packageManager set for Yarn v1.22.19
$ cat package.json | grep packageManager
"packageManager": "[email protected]"
# enable corepack, and it ignores the packageManager version
$ corepack enable
$ yarn --version
3.2.4
# manually ask corepack to use v1.22.19, but it again ignores this
$ corepack prepare [email protected] --activate
Preparing [email protected] for immediate activation...
$ yarn --version
3.2.4
# manually ask corepack to run yarn 1.22.19, but it again ignores it
$ corepack [email protected] --version
3.2.4
So using Corepack I don't seem to be able to convince it to use version of Yarn.
In addition installing using npm install -g
also doesn't seem to work correctly.
# disable corepack so there's no yarn installed
$ corepack disable
$ yarn --version
zsh: command not found: yarn
# install yarn v1.22.19
$ npm install -g [email protected]
added 1 package, and audited 2 packages in 326ms
found 0 vulnerabilities
# somehow it's installed 3.2.4 again
$ yarn --version
3.2.4
which yarn
return? β Tarboosh