Closed nealeu closed 4 months ago
Try npm install -g yarn
from the terminal window where you're attempting to run yarn -v
. The error message is telling you that the only version of yarn that asdf has shimmed is for nodejs 16.20.2; your current context appears to be running nodejs 18.19.0, so you need to run the install command in this new context to install a version of the yarn package that is compatible with the different version of node used by that context (18.19.0). See my comment for more.
@allisonphillips is correct, yarn
is not automatically installed on each version. In older versions yarn
was distributed inside NodeJS tarballs. Nowadays yarn
is packaged within corepack, so you need to enable it first:
corepack enable
asdf reshim nodejs
I just merged a new functionality to enable corepack automatically on new installations, just set the ASDF_NODEJS_AUTO_ENABLE_COREPACK
to anything on your shell's rc file and it should be good to go
In migrating from nodejs 16 to 18, I get the following when trying to run a yarn command (e.g. yarn -v)
This is despite having done as instructed.
The issue was in fact that under nodejs 16, I have yarn installed and there is a yarn shim, but under nodejs 18, I don't have yarn installed.
Doing
npm -g install yarn
resolves the above error.