Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

Error occurring while following ODOT series

Ok, so I am following along with ODOT series and I am on video 2 "Set up Git and Add Gems". The problem I am having is after I add this to my gem file:

group :development, :test do
  gem 'rspec-rails', '~> 2.0'
end

group :test do
  gem 'capybara', '~> 2.1.0'
end

And then run bundle in my terminal, I get the following error:

An error occurred while installing nokogiri (1.6.3.1), and Bundler cannot continue. Make sure that `gem install nokogiri -v '1.6.3.1'` succeeds before bundling.

Here is the complete output in my terminal:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /usr/local/rvm/rubies/ruby-1.9.3-p392/bin/ruby extconf.rb 
Building nokogiri using packaged libraries.
checking for iconv.h... yes
checking for iconv_open() in iconv.h... no
checking for iconv_open() in -liconv... no
checking for libiconv_open() in iconv.h... no
checking for libiconv_open() in -liconv... no
-----
libiconv is missing.  please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.
-----
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/usr/local/rvm/rubies/ruby-1.9.3-p392/bin/ruby
    --help
    --clean
    --use-system-libraries
    --enable-static
    --disable-static
    --with-zlib-dir
    --without-zlib-dir
    --with-zlib-include
    --without-zlib-include=${zlib-dir}/include
    --with-zlib-lib
    --without-zlib-lib=${zlib-dir}/lib
    --enable-cross-build
    --disable-cross-build


Gem files will remain installed in /usr/local/rvm/gems/ruby-1.9.3-p392/gems/nokogiri-1.6.3.1 for inspection.
Results logged to /usr/local/rvm/gems/ruby-1.9.3-p392/gems/nokogiri-1.6.3.1/ext/nokogiri/gem_make.out
An error occurred while installing nokogiri (1.6.3.1), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.3.1'` succeeds before bundling.```

2 Answers

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

Do just that - in your terminal write gem install nokogiri -v '1.6.3.1' , wait for it to finish installing and then try bundle install again.

OR change the RSpec gem version to 2.14, maybe this would help (don't do version 3, since it has some changes in the syntax)..

I tried that but I am still getting the same error.

I also tried changing the RSpec gem:

gem 'rspec-rails', '~> 2.14'
Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

OK, try newer version of RSpec (2.14) and newest capybara ('~> 2.4.1') - just chang ethos enumbers in the gemfile and run bundle install..

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

Also, are you, by any chance, using Vagrant?

I am not using Vagrant. Not even sure what it is...

I also tried changing the versions and running bundle install but that didn't work either.

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

OK, what operating system are you on? Does bundle work when you remove rspec or capybara from gemfile?

I am running a Mac OS X 10.7.5

Bundle works and I no longer get an error after I remove capybara gem

I don't know if these means anything but, when I ran my first bundle (before adding those two gems) I got this output in my terminal

Warning: You're using Rubygems 1.8.25 with Spring. Upgrade to at least Rubygems 2.1.0 and run `gem pristine --all` for better startup performance.
* bin/rake: spring inserted
* bin/rails: spring inserted

Guess not since I just updated my RubyGems and still the same error. :(

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

Did you try doing these things from the links? Especially the first one and the second one?

Hi Maciej,

I did but still no luck. I posted another question similar to this one earlier that is a little different and may be helpful. https://teamtreehouse.com/forum/trouble-installing-nokogiri-odot-series

Thanks for all your help you deserve an award!