Reputation: 1239
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?
Upvotes: 5
Views: 8025
Reputation: 21736
gem update --system & gem pristine nokogiri
gem install nokogiri
(building up on @Jonny answer — thank you !)
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.
Upvotes: 0
Reputation: 5847
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
Upvotes: 0
Reputation: 71
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
Upvotes: 3
Reputation: 471
Try running:
gem update --system
& gem pristine nokogiri
Just worked for me.
Upvotes: 7
Reputation: 9764
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
Upvotes: 0
Reputation: 1466
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/
Upvotes: 0