Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Ruby

Is Nokogiri required for bundling [ODOT Project]? Error when bundling.

I get the following error when bundling. I inserted this code in my Gemfile:

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

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

Afterwords I got this error:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /Users/myname/.rbenv/versions/2.1.2/bin/ruby extconf.rb 
Building nokogiri using packaged libraries.
-----
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=/Users/guled/.rbenv/versions/2.1.2/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

extconf failed, exit code 1

Gem files will remain installed in /Users/myname/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.2.1 for inspection.
Results logged to /Users/myname/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-13/2.1.0-static/nokogiri-1.6.2.1/gem_make.out
An error occurred while installing nokogiri (1.6.2.1), and Bundler cannot
continue.
Make sure that `gem install nokogiri -v '1.6.2.1'` succeeds before bundling.

I did not see the instructor download 'nokogiri' whatsoever.

2 Answers

Nokogiri is a dependency of capybara, so it is required if you want the feature specs to work. Not sure why it is failing to install for you. Here's an old post with information that may be helpful. https://teamtreehouse.com/forum/gem-nokogiri-error

Thank you.

Nokogiri is a dependency of capybara, so it is required if you want the feature specs to work. Not sure why it is failing to install for you. Here's an old post with information that may be helpful.