How should yarn be upgraded to the latest version?
yarn
If you already have yarn 1.x and you want to upgrade to yarn 2. You need to do something a bit different:
1.x
yarn set version berry
Where berry is the code name for yarn version 2. See this migration guide here for more info.