How do you set the yarn version inside the official yarn step?

yarn
#1

Hello people,

I’m moving our project from npm to yarn and I want to make sure that bitirise uses the intended yarn version to run the commands. How can you set the yarn version inside the official step? Thank you!

0 Likes

#2

Hello there @lucian.pacurar :wave:

On the MacOS stacks yarn is installed via brew (homebrew), so in case you need the latest version, you can upgrade using brew life this: brew upgrade yarn

Or if you need a specific version, you can switch between versions using brew switch yarn VERSION_NUMBER. If you are unsure, you can then verify the versions available to Homebrew by running: brew list --versions yarn.

You can read a bit more about this in this thread: https://stackoverflow.com/questions/44448084/how-do-i-change-the-version-of-yarn-used

Hope this helps! :slight_smile:

0 Likes

#3

I found another way of doing which is platform agnostic: https://classic.yarnpkg.com/en/docs/cli/policies
The downside is that you have to commit the .yarn folder else the step will crash.
So it would be great if the Bitrise step would incluse the yarn version to use.

0 Likes

#4

Now that brew switch is no longer available, how can you use a specific version of yarn?

0 Likes