Read more

Get rid of WARNING: Nokogiri was built against LibXML version 2.7.7, but has dynamically loaded 2.7.8

Deleted user #6
September 27, 2012Software engineer

If you get this warning on your local machine one of these steps might help:

Illustration online protection

Rails Long Term Support

Rails LTS provides security patches for old versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2)

  • Prevents you from data breaches and liability risks
  • Upgrade at your own pace
  • Works with modern Rubies
Read more Show archive.org snapshot

Rebuilt the gem with the newer library

gem install --no-rdoc --no-ri nokogiri -- --with-xml2-include=/opt/local/include/libxml2 --with-xml2-lib=/opt/local/lib

If you still get the error, try to uninstall all nokogiri versions with

gem uninstall nokogiri

and install nokogiri again.

Fixing the issue on servers

However, on our servers this probably will not work. On the server, gems are stored in the ../shared/bundle/ruby/:version/gems directory (relative to the current app directory).
If you do gem install in the current app directory, bundler will have no knowledge of this.

What you want to do instead is

bundle pristine nokogiri

and restart the application servers (e.g. b cap <environment> passenger:restart)

This should install the right nokogiri version and make the warning go away.

Posted to makandra dev (2012-09-27 16:05)