Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nokogiri error when running bundle install

Tags:

Trying to get a cloned Rails app running. When running bundle install I get this error:

Using mini_portile (0.5.0) Installing nokogiri (1.6.0) Gem::InstallError: nokogiri requires Ruby version >= 1.9.2. An error occurred while installing nokogiri (1.6.0), and Bundler cannot continue. Make sure that `gem install nokogiri -v '1.6.0'` succeeds before bundling. 

But this is the output for rbenv version:

› rbenv version 1.9.3-p429 (set by /Users/andrewguo/.rbenv/version) 

When running gem list I get:

. . . mini_portile (0.5.0) minitest (2.5.1) multi_json (1.7.7) nokogiri (1.6.0) 

I've been racking my brain for an hour now trying to figure out what can possibly be wrong... Please help!

Edit:

Here's a more verbose error output:

An error occurred while installing nokogiri (1.6.0), and Bundler cannot continue. Make sure that `gem install nokogiri -v '1.6.0'` succeeds before bundling. Bundler::InstallError: An error occurred while installing nokogiri (1.6.0), and Bundler cannot continue. Make sure that `gem install nokogiri -v '1.6.0'` succeeds before bundling. /Library/Ruby/Gems/1.8/gems/bundler-1.3.5/lib/bundler/installer.rb:130:in `install_gem_from_spec' /Library/Ruby/Gems/1.8/gems/bundler-1.3.5/lib/bundler/installer.rb:91:in `run' /Library/Ruby/Gems/1.8/gems/bundler-1.3.5/lib/bundler/installer.rb:90:in `run' /Library/Ruby/Gems/1.8/gems/bundler-1.3.5/lib/bundler/installer.rb:14:in `install' /Library/Ruby/Gems/1.8/gems/bundler-1.3.5/lib/bundler/cli.rb:247:in `install' /Library/Ruby/Gems/1.8/gems/bundler-1.3.5/lib/bundler/vendor/thor/task.rb:27:in `__send__' /Library/Ruby/Gems/1.8/gems/bundler-1.3.5/lib/bundler/vendor/thor/task.rb:27:in `run' /Library/Ruby/Gems/1.8/gems/bundler-1.3.5/lib/bundler/vendor/thor/invocation.rb:120:in `invoke_task' /Library/Ruby/Gems/1.8/gems/bundler-1.3.5/lib/bundler/vendor/thor.rb:344:in `dispatch' /Library/Ruby/Gems/1.8/gems/bundler-1.3.5/lib/bundler/vendor/thor/base.rb:434:in `start' /Library/Ruby/Gems/1.8/gems/bundler-1.3.5/bin/bundle:20 /Library/Ruby/Gems/1.8/gems/bundler-1.3.5/lib/bundler/friendly_errors.rb:3:in `with_friendly_errors' /Library/Ruby/Gems/1.8/gems/bundler-1.3.5/bin/bundle:20 /usr/bin/bundle:19:in `load' /usr/bin/bundle:19 
like image 669
wikichen Avatar asked Jun 20 '13 01:06

wikichen


People also ask

Can t install Nokogiri?

Solution. Uninstall all versions of Nokogiri on your system, and then re-resolve your dependencies (using bundle or gem install ). This error can occur when a version of Nokogiri installed for a different version of Ruby is used by an unsupported version of Ruby.

What is GEM Nokogiri?

The Nokogiri gem is an incredible open-source tool that parses HTML and XML data. It is one of the most widely used gems available, and it can really take your Ruby app to another level for data with its ability to help you intuitively scrape websites.

What does Nokogiri do?

Nokogiri (htpp://nokogiri.org/) is the most popular open source Ruby gem for HTML and XML parsing. It parses HTML and XML documents into node sets and allows for searching with CSS3 and XPath selectors. It may also be used to construct new HTML and XML objects.


2 Answers

I'm using Mac OSX (El Capitan) and it appears to be related to Xcode Developer Tools. I ran xcode-select --install in my working directory, then reran bundle install command and it all worked fine after that ^^.

Hope this could help someone.

like image 171
Edouard Avatar answered Oct 07 '22 19:10

Edouard


I ran into this error and this is what worked for me:

bundle config build.nokogiri --use-system-libraries bundle install 

The problem was with libxml:

libxml2 is missing.  Please locate mkmf.log to investigate how it is failing. 
like image 44
Phil Avatar answered Oct 07 '22 20:10

Phil