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:
Make sure that you have NPM installed by running the following command:
If NPM is not installed, you can install it by running:
Install Yarn using the following command: 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:
If the above steps don't work, try updating NPM by running the following command:
Finally, try installing Yarn again:
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.