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
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
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.
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