LoginSignup
35
23

More than 5 years have passed since last update.

brew install yarn --without-node してもnodeがインストールされる。

Last updated at Posted at 2019-01-26

 追記(2019/2/19)

@ys-0-sy さんからコメントいただきました。

yarn公式のインストレーションガイドによると,node.jsをインストールした状態で

$brew install yarn --ignore-dependencies

とすれば良いようです.

今回の状況(node.jsのバージョン管理ツールで既にnode.jsを使用できる)ですと
こちらの方法がよいかと思われます。
コメントありがとうございました!


 背景

nodebrewとyarnをHomebrewで入れる際に
yarnに付随してnodeがインストールされてnodebrewでのバージョン管理がうまくいかなくなる。
と小耳に挟んだので、これを回避するために

ターミナル
brew install yarn --without-node

を実行したがnodeもインストールされていた。

 調査

インストール中のメッセージを読み進めていくと

ターミナル
Warning: yarn: this formula has no --without-node option so it will be ignored!

「yarnに--without-nodeってoptionはないので、無視しますよ〜。」
そうですか…

ググって、下記にたどり着く
https://github.com/yarnpkg/yarn/issues/6946

どうやら最近のHomebrewのアップデートで--without-nodeは使えなくなったらしい。

 対策

ターミナル
brew install yarn
brew uninstall --ignore-dependencies node

yarnをインストールした後にnodeをアンインストールした。
--ignore-dependenciesをつけないと
yarnがnodeに依存しているので実行できませんでした。と言われます。

ターミナル
❯ brew uninstall node
Error: Refusing to uninstall /usr/local/Cellar/node/11.7.0
because it is required by yarn, which is currently installed.
You can override this and force removal with:
  brew uninstall --ignore-dependencies node

 最後に

初心者&独学なので間違いなどあるかもしれません。
他にも方法がありましたら、コメントに残していただけると幸いです。

 参考

35
23
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
35
23