Help us understand the problem. What is going on with this article?

brew install yarn --ignore-dependencies で困ったのでメモ

概要

フロントエンド勉強しようと思って、
nodebrewからnodeを入れたはいいが、
brewからyarn入れようと思ったときにハマったのでメモとして残しておく。

手順としては下記の記事を参考にした。
https://qiita.com/morikiyo/items/cd219a0b7aaed5b23d51

エラー内容

yarnの公式( https://classic.yarnpkg.com/ja/docs/install#mac-stable ) 見ると、nodebrewでnodeを入れてる場合は下記コマンドを叩くとのこと。

brew install yarn --ignore-dependencies

そうするとこんなエラーが。

Warning: --ignore-dependencies is an unsupported Homebrew developer flag!
Adjust your PATH to put any preferred versions of applications earlier in the
PATH rather than using this unsupported flag!

Error: An exception occurred within a child process:
  RuntimeError: /usr/local/opt/node not present or broken
Please reinstall node. Sorry :(

色々いじってる環境なので発生しない人には発生しない問題だとは思う。。。
npmで最終的にyarn入れた人はこの問題にぶち当たったのではないかと。。。

対応策

こんな感じで、最新のnode使うようにシンボリックリンクを貼った。

$ mkdir /usr/local/opt/node
$ ln -s .nodebrew/current/ /usr/local/opt/node/
$ brew install yarn --ignore-dependencies
Warning: --ignore-dependencies is an unsupported Homebrew developer flag!
Adjust your PATH to put any preferred versions of applications earlier in the
PATH rather than using this unsupported flag!

==> Downloading https://yarnpkg.com/downloads/1.22.4/yarn-v1.22.4.tar.gz
Already downloaded: /Users/xxx/Library/Caches/Homebrew/downloads/42f75ed3036d8636bc54f4cf04cd43310a9662428287c2f0187e82ebedf82c95--yarn-v1.22.4.tar.gz
🍺  /usr/local/Cellar/yarn/1.22.4: 14 files, 5MB, built in 4 seconds

というわけで、yarnを入れることに成功。

$ yarn -v
1.22.4
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした