【问题标题】:Git Bundle Install Error with Nokogiri: libxms2 is missingNokogiri 的 Git Bundle 安装错误:缺少 libxms2
【发布时间】:2011-05-04 09:15:03
【问题描述】:

我正在关注 Michael Hatrl 的 Ruby on Rails Learn by Example 教程,但由于出现错误,我在第 3 章中卡住了。我被告知输入: 'rails 生成控制器页面主页联系人'

它在哪里响应: 在您的 Gemfile 中列出的任何 gem 源中都找不到 gem 'webrat (= 0.7.1)'。尝试运行“捆绑安装”

宝石文件:

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

【问题讨论】:

    标签: ruby-on-rails


    【解决方案1】:

    我需要按照 ipsum 的建议进行操作:

    Debian 或 Ubuntu 安装“libxml2-dev”软件包。

    sudo apt-get install libxml2-dev
    

    我也需要:

    sudo apt-get install libxslt-dev
    

    【讨论】:

      【解决方案2】:

      使用 Windows 7:

      根据您引用的“libxml2 is missing”错误,我也得到了这个并返回到 Cygwin 的 setup.exe 并从那里安装(在“lib”树下查找它)。

      从 ruby​​onrails.org 安装 DevKit 没有帮助。

      【讨论】:

        【解决方案3】:

        如果您使用的是 Debian 或 Ubuntu,请安装“libxml2-dev”软件包。 (sudo apt-get install libxml2-dev)。

        【讨论】:

        • 我忘记添加了。我在 Windows 上使用 Git =P
        【解决方案4】:

        我在安装 github-pages 时在 OSX 中遇到了这个问题。我需要做的就是使用 brew 安装 libxml2libxslt

        brew install libxml2 libxslt
        

        安装这些库后,我指定在安装 nokogiri 时捆绑使用我的系统库:

        bundle config build.nokogiri --use-system-libraries
        

        然后我运行:

        bundle install
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 2013-04-11
          • 1970-01-01
          • 2013-01-06
          • 1970-01-01
          • 2016-02-09
          • 1970-01-01
          • 2011-10-27
          相关资源
          最近更新 更多