After running
brew install yarn
I have the below version of node
installed on my system:
$ node -v
v10.5.0
because node
is a dependency of yarn
(correct me if I'm wrong, please tell me if I'm right too)
But it causes problem with yarn
(the problem I face is this) so I want to use an older version of node
to make my app work now. According to this, I did these:
$ brew install node@8
$ brew unlink node
$ brew link node@8
But $ brew link node@8
gives me the following:
Warning: node@8 is keg-only and must be linked with --force
Note that doing so can interfere with building software.
If you need to have this software first in your PATH instead consider running:
echo 'export PATH="/usr/local/opt/node@8/bin:$PATH"' >> ~/.zshrc
I used rvm, ruby can be switch by simply using rvm use ruby-version-here
so I think brew link formula
will work, but why it needs force?
I understand that brew's keg-only means it's only in cellar and not linked in /usr/local/bin/ or /usr/local/lib/, but isn't brew link helping us link it, why does it need the --force option, what does it do, it feels dangerous.
brew help link
says:
If --force (or -f) is passed, Homebrew will allow keg-only formulae to be linked.
Why should we be careful to link them? Will we break something?
I want to use node@8
instead of node (the latest version)
, what is the correct way to do this? Do I just run with the force option as suggested by brew?
Update 1: When I keep searching and finding out why, I saw this, but I don't understand it fully. It seems like it needs to delete some file when linking to new version of formula. But I thought linking will be just replacing the link somewhere, maybe just replace one file? Why create a specific --force option for linking to new keg-only formula? I suspect there is something special about keg-only formula's nature. Does anyone understand why?