Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

brew install yarn version

I tried using

brew install [email protected] --without-node 

or

brew install [email protected] --without-node 

But I get the following error

Error: No available formula with the name "[email protected]"  ==> Searching for a previously deleted formula (in the last month)... Warning: homebrew/core is shallow clone. To get complete history run:   git -C "$(brew --repo homebrew/core)" fetch --unshallow  Error: No previously deleted formula found. ==> Searching for similarly named formulae... Error: No similarly named formulae found. ==> Searching taps... ==> Searching taps on GitHub... Error: No formulae found in taps. 

I presume its possible to install different versions of yarn using brew ?

like image 305
me-me Avatar asked Aug 20 '18 23:08

me-me


People also ask

How do I install a specific version of yarn?

You can specify versions using one of these: yarn add package-name installs the “latest” version of the package. yarn add [email protected] installs a specific version of a package from the registry. yarn add package-name@tag installs a specific “tag” (e.g. beta , next , or latest ).


1 Answers

I had the same issue and wanted to install yarn via brew for various reasons. Honestly the only way is to use the actual link to the yarn.rb file in the Homebrew Repo for the version you want. The easiest way to find the .rb file through git is to check out the PRs in Git for yarn in the homebrew repo.

  • Before doing this though, run brew unlink yarn in order to allow an older version to be installed while keeping the newest version.

  • Then look up the PR of the version you want, here's a link to make your life easier.

  • Click the version you want and go to Files Changed tab. Click on View File button. Then click on Raw button and then copy the URL of this raw file

  • After you get that link, type in your terminal brew install [link] and you should be set

You can then use brew list --versions yarn to check your installed versions and brew switch to switch versions. You should have both the latest version you previously had installed and the version you just installed.

like image 179
Mim Cobaj Avatar answered Oct 04 '22 15:10

Mim Cobaj