While you install a new node version using nvm and then used npm to install yarn, you need to reinstall the yarn for the new node version.

Check the currently installed version of Node.js using the following command:

nvm current
This will output the currently active version of Node.js.

Make sure that you have NPM installed by running the following command:
npm -v

If NPM is not installed, you can install it by running:
npm install npm -g

Install Yarn using the following command:
npm install -g yarn
This will install Yarn globally on your system.

If you are still having trouble installing Yarn, try clearing your NPM cache by running the following command:
npm cache clean --force

If the above steps don't work, try updating NPM by running the following command:
npm install -g npm@latest

Finally, try installing Yarn again:
npm install -g yarn

If you continue to have issues with Yarn installation, you can try installing it using the official Yarn installation instructions, which can be found at https://classic.yarnpkg.com/en/docs/install.