Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git Bundle Install Error with Nokogiri: libxms2 is missing

I'm following the Ruby on Rails Learn by Example by Michael Hatrl tutorial but I'm stuck halfway through chapter 3 due to an error. I'm told to type: 'rails generate controller Pages home contact'

where it responds with: 'Could not find gem 'webrat (= 0.7.1)' in any of the gem sources listed in your Gemfile. Try running 'bundle install'

Gemfile:

source 'http://rubygems.org'

gem 'rails', '3.0.1'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'sqlite3-ruby', '1.3.2', :require => 'sqlite3'

group :development do
  gem 'rspec-rails', '2.5.0'
end

group :test do
  gem 'rspec', '2.5.0'
  gem 'webrat', '0.7.1'
end

# Use unicorn as the web server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'ruby-debug'

# Bundle the extra gems:
# gem 'bj'
# gem 'nokogiri'
# gem 'sqlite3-ruby', :require => 'sqlite3'
# gem 'aws-s3', :require => 'aws/s3'

# Bundle gems for the local environment. Make sure to
# put test-only gems in this group so their generators
# and rake tasks are available in development mode:
# group :development, :test do
#   gem 'webrat'
# end

When I try 'bundle install' it lists all the file and when it gets to nokogiri an error comes up. The main error part being:

Installing nokogiri (1.4.4) with native extensions
/usr/lib/ruby/site_ruby/1.8/rubygems/installer.rb:533:in 'build extensions': ERROR: 
Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)

            /usr/bin/ruby.exe extconf.rb
checking for libxml/parser.h... no
-----
libxml2 is missing. please visit http://nokogiri.org/tutorials/installing_nokogiri.html
for help with installing dpenedencies.
-----
*** 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 details. You may need configuration options.

Please help I need to finish the whole book quickly and this speedbump is slowing me down =(

Edit: I am using Git on Windows 7

like image 326
Sean Avatar asked May 04 '11 09:05

Sean


2 Answers

I needed to do the same as ipsum suggested:

Debian or Ubuntu install the "libxml2-dev" package.

sudo apt-get install libxml2-dev

I also needed:

sudo apt-get install libxslt-dev
like image 86
duyker Avatar answered Nov 11 '22 22:11

duyker


using Windows 7:

per the "libxml2 is missing" error you reference, I got this too and went back to Cygwin's setup.exe and installed from there (look for it under the "lib" tree).

Installing the DevKit from rubyonrails.org did not help.

like image 22
Chris Avatar answered Nov 11 '22 22:11

Chris