LoginSignup
36
33

More than 5 years have passed since last update.

Ruby on Rails nokogiriエラーでbundle installできない

Last updated at Posted at 2015-06-10

1. 環境たち

下記環境でRuby on Railsの環境を構築中

  • CentOS 7
  • rbenc 0.4.0
  • ruby 2.2.0
  • rails 4.2.1

2. nokogiriエラー

command
$ bundle install --path=~/sample/vendor/bundle

bundle install時にエラーが発生

error
Gem files will remain installed in /var/www/demo/vendor/bundle/ruby/2.2.0/gems/nokogiri-1.6.6.2 for inspection.
Results logged to /var/www/demo/vendor/bundle/ruby/2.2.0/extensions/x86_64-linux/2.2.0-static/nokogiri-1.6.6.2/gem_make.out
An error occurred while installing nokogiri (1.6.6.2), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.6.2'` succeeds before bundling.

3. 解決方法

nokogiriはシステムのライブラリを使用するように設定する

command
$ bundle config build.nokogiri --use-system-libraries

また、システムには下記のライブラリがインストール済みである必要がある

  • libxml2-devel
  • libxslt-devel

再度bundle install

command
$ bundle install --path=~/sample/vendor/bundle

うまくいきました

36
33
2

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
36
33