背景
非同期処理を実装しようと考えて、jqueryのgemをインストールしようとして「bundle install」したら、以下のエラーが出ました。そもそも、新たに追加するgem以外は、インストールされている認識だったのですが…
Installing libv8 3.16.14.19 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
../src/utils.h:33:10: fatal error: 'climits' file not found
#include <climits>
^~~~~~~~~
1 error generated.
環境
項目 | 内容 |
---|---|
OS.Catalina | v10.15.4 |
Ruby | v2.5.1 |
Ruby On Rails | v5.2.4.3 |
内容
対応1)bundlerの設定を施す
以下のコマンドを実行し、バンドラーを個別設定しました。関係する「therubyracer」も同様に設定しておきます。
CMD>bundle config --local build.libv8 --with-system-v8
You are replacing the current local value of build.libv8, which is currently nil
CMD>bundle config --local build.therubyracer --with-v8-dir=/usr/local/opt/v8@3.15
You are replacing the current local value of build.therubyracer, which is currently nil
以下のコマンドで登録されたことを確認します。
CMD>bundle config
build.libv8
Set for your local app (/Users/ichikawadaisuke/projects/krown/.bundle/config): "--with-system-v8"
build.therubyracer
Set for your local app (/Users/ichikawadaisuke/projects/krown/.bundle/config): "--with-v8-dir=/usr/local/opt/v8@3.15"
(ここで、通らないpathを設定していたため、gemのインストール時に失敗しました。)
次はなぜか。mysqlのエラーが…
Installing mysql2 0.5.2 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
to be continued....
参考記事
Rails の bundle install 時に出会った therubyracer のエラーと、その解決方法
Rails で therubyracer をインストールしているのに bundle install が通らない時の対処
therubyracerがインストールできない