18
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

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

Posted at

概要

フロントエンド勉強しようと思って、
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
18
8
1

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
18
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?