1
1

More than 3 years have passed since last update.

nokogiriのエラーでbundle installが出来ない。libxsltのインストールで解決

Posted at

nokogiriのインストールでエラー

bundle install --path vendor/bundle/ するとnokogiriのインストールでエラー。

An error occurred while installing nokogiri (1.6.7.1), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.7.1' --source 'https://rubygems.org/'` succeeds before bundling.

指示通りにgem install nokogiri -v '1.6.7.1' --source 'https://rubygems.org/'してみても状況は変わらず。

gem_make.out確認

gem_make.outにResultがあると書かれてあるので見てみる。↓

$ cat ./vendor/bundle/ruby/2.2.0/extensions/x86_64-linux/2.2.0-static/nokogiri-1.6.7.2/gem_make.out
/usr/local/rbenv/versions/2.2.2/bin/ruby -r ./siteconf20200313-12822-1iyzulw.rb extconf.rb --use-system-libraries
checking if the C compiler accepts ... yes
Building nokogiri using system libraries.
libxml2 version 2.6.21 or later is required!
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/usr/local/rbenv/versions/2.2.2/bin/$(RUBY_BASE_NAME)
        --help
        --clean
        --use-system-libraries
        --with-zlib-dir
        --without-zlib-dir
        --with-zlib-include
        --without-zlib-include=${zlib-dir}/include
        --with-zlib-lib
        --without-zlib-lib=${zlib-dir}/lib
        --with-xml2-dir
        --without-xml2-dir
        --with-xml2-include
        --without-xml2-include=${xml2-dir}/include
        --with-xml2-lib
        --without-xml2-lib=${xml2-dir}/lib
        --with-libxml-2.0-config
        --without-libxml-2.0-config
        --with-pkg-config
        --without-pkg-config
        --with-xslt-dir
        --without-xslt-dir
        --with-xslt-include
        --without-xslt-include=${xslt-dir}/include
        --with-xslt-lib
        --without-xslt-lib=${xslt-dir}/lib
        --with-libxslt-config
        --without-libxslt-config
        --with-exslt-dir
        --without-exslt-dir
        --with-exslt-include
        --without-exslt-include=${exslt-dir}/include
        --with-exslt-lib
        --without-exslt-lib=${exslt-dir}/lib
        --with-libexslt-config
        --without-libexslt-config

extconf failed, exit code 1

libxml2 version 2.6.21 or later is required! と書かれてるので、ここら辺があやしい。
Check the mkmf.log file for more details. とあるので見てみる。

mkmf.log 確認

$ cat ./vendor/bundle/ruby/2.2.0/extensions/x86_64-linux/2.2.0-static/nokogiri-1.6.7.2/mkmf.log

〜〜省略〜〜
package configuration for libxml-2.0 is not found
package configuration for libxslt is not found
package configuration for libexslt is not found

どうやらlibxml系のパッケージが見つからないみたいなことが書かれていた。

libxsltインストール

libxsltをインストールする。

yum install libxslt-devel

libxsltインストール完了後、無事bundle installができるようになった。

1
1
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
1
1