我跑了bundle install,我得到了这个错误:

Building nokogiri using system libraries.

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

    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb --use-system-libraries
Building nokogiri using system libraries.
libxml2 version 2.6.21 or later is required!
*** 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=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
    --help
    --clean
    --use-system-libraries
    --with-zlib-dir
    --without-zlib-dir
    --with-zlib-include
    --without-zlib-include=${zlib-dir}/include
    --with-zlib-lib
    --without-zlib-lib=${zlib-dir}/lib
    --with-xml2-dir
    --without-xml2-dir
    --with-xml2-include
    --without-xml2-include=${xml2-dir}/include
    --with-xml2-lib
    --without-xml2-lib=${xml2-dir}/lib
    --with-libxml-2.0-config
    --without-libxml-2.0-config
    --with-pkg-config
    --without-pkg-config
    --with-xslt-dir
    --without-xslt-dir
    --with-xslt-include
    --without-xslt-include=${xslt-dir}/include
    --with-xslt-lib
    --without-xslt-lib=${xslt-dir}/lib
    --with-libxslt-config
    --without-libxslt-config
    --with-pkg-config
    --without-pkg-config
    --with-exslt-dir
    --without-exslt-dir
    --with-exslt-include
    --without-exslt-include=${exslt-dir}/include
    --with-exslt-lib
    --without-exslt-lib=${exslt-dir}/lib
    --with-libexslt-config
    --without-libexslt-config
    --with-pkg-config
    --without-pkg-config

extconf failed, exit code 1

Gem files will remain installed in /Users/myuser/projectpath/vendor/bundle/ruby/2.0.0/gems/nokogiri-1.6.2.rc2 for inspection.
Results logged to /Users/myuser/projectpath/vendor/bundle/ruby/2.0.0/extensions/universal-darwin-13/2.0.0/nokogiri-1.6.2.rc2/gem_make.out
An error occurred while installing nokogiri (1.6.2.rc2), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.2.rc2'` succeeds before bundling.

你知道这是什么吗?

EDIT:

我还安装了instructions in the tutorial之后的nokogiri,奇怪的是gem安装成功了.当我运行gem list时,我有nokogiri (1.6.2.1)个,但当运行bundle install时,它会显示错误.

推荐答案

之前的建议对我没有帮助,以下是OS 10.9的解决方案:

brew install libxml2
bundle config build.nokogiri "--use-system-libraries --with-xml2-include=/usr/local/opt/libxml2/include/libxml2"
bundle install

Ruby-on-rails相关问答推荐

Rails版本7.1.2:当验证失败且控制器发送422状态时,JS停止工作

DateTime的最小数据提交格式

Rails6.1|有没有一种方法可以判断哪些关联已经加入到一个范围中?

我的 Ruby on Rails Web API 的 Docker 映像未在服务器上构建,因为它未与 ruby​​gems.org 连接

Rails 控制台 - 更新 Gem 后的弃用通知

Rails 自动加载完全大写的名称,如 API

Ruby - ActiveRecord::ConnectionNotEstablished

没有图像时如何在回形针中显示隐藏图像

URL中的Rails点而不是斜杠

升级到设计 3.1 => 获取重置密码令牌无效

Rails 3 SSL 路由从 https 重定向到 http

确认后如何进行设计重定向

您将 Rack 中间件文件和要求放在哪里?

Rails 控制台中手动更新属性值的验证问题

如何打印出范围之间的随机数?

Heroku Postgres 错误:PGError:错误:关系组织不存在(ActiveRecord::StatementInvalid)

:javascript haml 标签中的内联Ruby ?

如何在 Ruby 中搜索数组?

如何在两个字段上对 ruby​​/rails 进行排序?

ActiveModel::MissingAttributeError:无法使用 FactoryGirl 写入未知属性ad_id