我正在关注 Michael Hatrl 的 Ruby on Rails Learn by Example 教程,但由于错误,我在第 3 章中途被卡住了。我被告知输入:
'rails 生成 Controller 页面主页联系人'
它的回应是:
'在 Gemfile 中列出的任何 gem 源中找不到 gem 'webrat (= 0.7.1)'。尝试运行“捆绑安装”
gem 文件:
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
当我尝试“捆绑安装”时,它会列出所有文件,当它到达 nokogiri 时会出现错误。主要错误部分是:
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.
请帮助我需要快速完成整本书,而这个减速带正在减慢我的速度 =(
编辑:我在 Windows 7 上使用 Git
最佳答案
我需要做与 相同的事情ipsum 建议:
Debian 或 Ubuntu 安装“libxml2-dev”包。
sudo apt-get install libxml2-dev
我还需要:
sudo apt-get install libxslt-dev
关于ruby-on-rails - Nokogiri : libxms2 is missing 的 Git 捆绑安装错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5881156/