我跑了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相关问答推荐

如何修复:错误:'' 没有提交判断致命:输入“git add”时添加文件失败.在命令提示符下

Ruby on Rails 中的邮箱验证?

在 Rails 5.1 及更高版本中使用什么来代替`render :text`(和`render nothing: true`)?

如何将 SQL 文件导入 Rails 数据库?

FactoryBot 工厂中的“临时执行”块的目的是什么?

Heroku:不能运行超过 1 个免费大小的测功机

Rails 5,Rspec:架构中未找到环境数据

slick.js 中的错误:“未捕获的 TypeError:无法读取属性 'add' of null”

Rails 服务器仍在新打开的 docker 容器中运行

在 El Capitan 上安装 Nokogiri (1.6.7) 时出错

rails 回调中 after_create、after_save 和 after_commit 的区别

未捕获的 ReferenceError:未定义 ReactDOM

当 AWS 存在时,为什么人们会使用 Heroku? Heroku 与 AWS 的区别是什么?

如何在 Rails 上禁用“无法从...渲染控制台”

Rails:包含多态关联

如何使用 Rspec 判断 ActiveJob 中排队的内容

OpenSSL::SSL::SSLError: SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read server hello A

Rails - 用 2 个字段查找?

我如何找出为什么我不能#destroy() 记录?

带有自定义列名的 Rails belongs_to