I seem to be in a recursive loop of frustration. I'm trying to "bundle install" a project, but it results in:
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.
So I try that:
$ gem install nokogiri -v '1.6.6.2'
Building native extensions. This could take a while...
Successfully installed nokogiri-1.6.6.2
Parsing documentation for nokogiri-1.6.6.2
Done installing documentation for nokogiri after 2 seconds
1 gem installed
All good! Except that when I run "bundle install", I am again told I need to get "gem install nokogiri -v '1.6.6.2'" to install first. AHHHHH.
The mkmf.log file suggests this is an issue with libxml2 (surprise surprise).
conftest.c:3:10: fatal error: 'libxml/xmlversion.h' file not found
#include <libxml/xmlversion.h>
^
1 error generated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <libxml/xmlversion.h>
4:
5: #if LIBXML_VERSION < 20621
6: #error libxml2 is way too old
7: #endif
/* end */
So, searching for libxml2 (with "sudo find / -name libxml2") reveals these directories, all of which appear to be at least 2.9.0 or higher:
So, is the issue that libxml2 can't be found? And if so, how do I get bundle install to realize that nokogiri is already installed, or at least be able to install it the same way "gem install" does? While I'd like to find a solution for this, I'm really interested in learning what is going on "under the covers" so I can troubleshoot in the future.
On my Mac OS X, I ran these commands, and the problem is fixed.
brew unlink gcc-4.2 # you might not need this step
gem uninstall nokogiri
xcode-select --install
gem install nokogiri
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With