Nokogiri Installation Fails -Libxml2 Is Missing

Rails : bundle install nokogiri fail

Possible duplicates:

  • Mac OS X: Error to install Nokogiri on OSX 10.9 Maverick?
  • Ubuntu: Error installing Nokogiri 1.5.0 with rails 3.1.0 and ubuntu

The problem is probably that you have to natively install libxml and libxslt, which Nokogiri relies on.

If you run gem install nokogiri -v '1.6.2.1' | grep libxml, does anything show up?

Error installing Nokogiri via Bundler on Windows

This particular version of Nokogiri is listed in Gemfile.lock. You can remove that file, run bundle install again and see if it works.

This is more a workaround than a proper solution, but dependencies in Gemfile.lock are quite old so it would be a good thing to refresh them anyway.

Why doesn't nokogiri install?

You shouldn't need sudo when you do gem install with rbenv. Unfortunately, the ownership is usually not correct for the .rbenv directory on a new install.

Do this first to set your permissions correctly:

sudo chown -R $USER "$HOME/.rbenv"

Then go ahead and just run the install again:

gem install nokogiri -v '1.6.1'

It should work without sudo.



Related Topics



Leave a reply



Submit