LoginSignup
0
2

More than 3 years have passed since last update.

bundle install でNokorigiインストール時に「Gem::Ext::BuildError: ERROR: Failed to build gem native extension.」エラーが出た場合の対処方法

Posted at

bundle installでnokogiriインストール時に下記のようなエラー

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

が出てしまった場合

gem install時であれば --use-system-libraries オプションを付けて再実行してみるところですがbundlerの場合はどうすればいいかというと

bundle config --local build.nokogiri --use-system-libraries

というような感じでコマンドを実行します。

--localオプションはapp/.bundle/configへ設定を書きます。
--globalオプションは~/.bundle/configに書くようです。

まあよほどの事情がない限り、プロジェクトごとの.bundle/configに書いておくほうが良いと思います。その他、環境変数にも定義できます。

bundle configの優先順位

bundle configですが、mysqlなどと同様、複数の箇所に設定を保持しておけます。用途によって適切な場所に設定を書いておくのがいいと思いますが、bundleコマンドのhelpによると

DESCRIPTION
       This command allows you to interact with Bundler´s configuration system.

       Bundler loads configuration settings in this order:

       1.  Local config (app/.bundle/config)

       2.  Environmental variables (ENV)

       3.  Global config (~/.bundle/config)

       4.  Bundler default config

という優先順位で参照されます。

0
2
0

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
0
2