How should yarn be upgraded to the latest version?
yarn
I tried all of the above solutions in Jenkins pipeline which needs the latest yarn. Finally, this worked for me.
Note: This is helpful when you don't have root access to npm install -g yarn.