Nokogiri was built against LibXML version 2.9.1, but has dynamically loaded 2.8.0
Asked Answered
G

6

5

I want to run

bundle exec rake fixtures:populate_from_db

on CentOS but I get the following warning messages:

WARNING: Nokogiri was built against LibXML version 2.9.1, but has dynamically loaded 2.8.0
rake aborted!

~/.bundle/config file contains:

BUNDLE_BUILD__NOKOGIRI: "--with-xml2-include=/opt/local/include/libxml2 --with-xml2-lib=/opt/local/lib --with-xslt-dir=/opt/local"

How should I compile Nokogiri again 2.8.0 version of LibXML?

Geophysics answered 22/4, 2015 at 14:19 Comment(1)
Welcome to Stack Overflow. Have you read through the various similar questions in the "Related" links on the lower right of this page? What happened when you tried those things?Inject
G
7

Try running:

gem update --system & gem pristine nokogiri

Just worked for me.

Grunter answered 28/10, 2015 at 13:11 Comment(0)
W
3

The following steps solve my problem

gem uninstall nokogiri # remove nokogiri
NOKOGIRI_USE_SYSTEM_LIBRARIES=1 bundle install

Combine the solutions from https://simonharrer.wordpress.com/2013/05/01/fixing-nokogiri-warning-after-ubuntu-upgrade/ and https://github.com/sparklemotion/nokogiri/wiki/What-to-do-if-libxml2-is-being-a-jerk

Wellgroomed answered 18/2, 2016 at 12:37 Comment(1)
I needed to sudo apt-get install libxslt1-dev before NOKOGIRI_USE_SYSTEM_LIBRARIES=1 bundle installEntoil
C
0

Try this one:

gem install nokogiri -- --with-xml2-include=/usr/include/libxml2/libxml --with-xml2-lib=/usr/lib64/ --with-sxlt-include=/usr/include/libxslt --with-xslt-lib=/usr/lib64/
Civilize answered 22/4, 2015 at 14:26 Comment(0)
U
0

I know it sounds silly, but try putting Nokogiri at the top of your Gemfile. This works in some cases where other gems conflict on native extensions

Upstroke answered 22/4, 2015 at 14:47 Comment(0)
H
0

I had an old app locked at v1.5.11 of Nokogiri and I couldnt get rid of this issue on Debian 9 until I upgraded Nokogiri to v1.6.8.1

Hubble answered 24/9, 2017 at 12:51 Comment(0)
B
0

Summary

gem update --system & gem pristine nokogiri
gem install nokogiri

(building up on @Jonny answerthank you !)

Details

I had the same error than in the title.
After running his command, running a ruby script failed with this error:

/Users/username/.rvm/rubies/ruby-2.4.0/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:92:in `require': cannot load such file -- nokogiri (LoadError)
from /Users/username/.rvm/rubies/ruby-2.4.0/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:92:in `require'
from my_ruby_script.rb:3:in `<main>'

I then add to run gem install nokogiri again, and everything went back to normal.

Blen answered 15/5, 2020 at 20:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.