npmhomebrewyarnpkg

How do I change the version of yarn used?


I used Homebrew to install yarn. Running yarn -v shows that I currently use 0.23.2. I ran brew upgrade yarn to get the latest version, which is 0.24.6.

After Homebrew successfully upgrades yarn, I run yarn -v again, but the version is still 0.23.2. How can I change the version of yarn that I am running?


Solution

  • I found an answer. It's not the prettiest, but since yarn always tell me what the most update-to-date version is, I can use npm to just install the latest version.

    If the latest is 0.24.6

    npm install --global yarn@.24.6
    

    EDIT:

    According to yarn's official documentation, the way to install/upgrade is:

    brew install yarn
    
    brew upgrade yarn
    

    https://yarnpkg.com/en/docs/install#mac-stable