bundle install 時にエラーが出た際の解決法

エラー内容

bundle installした際にエラーが発生した。

  • インストールできなかったもの
    • nokogiri
    • puma
    • livb8
    • therubyracer
    • mysql2

解決方法

bundle config を以下のように設定

$ bundle config
Settings are listed in order of priority. The top value will be used.
path
Set for the current user (/Users/mimata/.bundle/config): "vendor/bundle "

build.nokogiri
Set for your local app (/Users/mimata/workspace/runteq/635_kazu-2020_runteq_learning_advanced/.bundle/config): "--use-system-libraries"

build.puma
Set for your local app (/Users/mimata/workspace/runteq/635_kazu-2020_runteq_learning_advanced/.bundle/config): "--with-cflags=-Wno-error=implicit-function-declaration"

build.libv8
Set for your local app (/Users/mimata/workspace/runteq/635_kazu-2020_runteq_learning_advanced/.bundle/config): "--with-system-v8"

build.therubyracer
Set for your local app (/Users/mimata/workspace/runteq/635_kazu-2020_runteq_learning_advanced/.bundle/config): "--with-v8-dir=/usr/local/opt/v8@3.15"

build.mysql2
Set for your local app (/Users/mimata/workspace/runteq/635_kazu-2020_runteq_learning_advanced/.bundle/config): "--with-ldflags=-L/usr/local/opt/openssl@1.1/lib"

Image from Gyazo

参考

bundle installを実行したらnokogiri関連でエラーが出る2 | ハックノート

macOS Mojaveで古いlibv8とtherubyracerが入らない時の対処法 - Qiita

【puma】puma4台インストールできない問題の対処法 - Qiita

mysql2 gemインストール時のトラブルシュート - Qiita