无法安装 Nokogiri gem [英] Failing to install Nokogiri gem

查看:76
本文介绍了无法安装 Nokogiri gem的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个 rails 应用程序,该应用程序允许为每个用户帐户添加图像附件.我使用的是回形针和亚马逊网络服务:

I'm working on a rails app that allows for image attachments to each use account. I'm using paperclip and amazon web services:

gem 'paperclip'
gem 'aws-sdk'

当我运行 bundle install 时,我收到以下消息:

When I run bundle install, I get this message:

extconf 失败,退出代码 1

extconf failed, exit code 1

Gem files will remain installed in /usr/local/rvm/gems/ruby-2.1.2/gems/nokogiri-1.6.5 for inspection.
Results logged to /usr/local/rvm/gems/ruby-2.1.2/extensions/x86_64-darwin-13/2.1.0-static/nokogiri-1.6.5/gem_make.out
An error occurred while installing nokogiri (1.6.5), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.5'` succeeds before bundling.

当我尝试运行gem install nokogiri"时,我收到以下消息:

When I try running 'gem install nokogiri', I get this message:

extconf 失败,退出代码 1

extconf failed, exit code 1

Gem files will remain installed in /usr/local/rvm/gems/ruby-2.1.2/gems/nokogiri-1.6.5 for inspection.
Results logged to /usr/local/rvm/gems/ruby-2.1.2/extensions/x86_64-darwin-13/2.1.0-static/nokogiri-1.6.5/gem_make.out

我的操作系统是 Mac OS X 10.9.4 Mavericks.这是怎么回事?如何让 nokogiri 安装并正常运行?

My OS is Mac OS X 10.9.4 Mavericks. What's going on here? How can I get nokogiri to install and behave properly?

完整的堆栈跟踪:

Building native extensions with: '--use-system-libraries'
This could take a while...
ERROR:  Error installing nokogiri:
    ERROR: Failed to build gem native extension.

    /usr/local/rvm/rubies/ruby-2.1.2/bin/ruby extconf.rb --use-system-libraries
checking if the C compiler accepts ... yes
checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future... yes
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=/usr/local/rvm/rubies/ruby-2.1.2/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-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

extconf failed, exit code 1

Gem files will remain installed in /usr/local/rvm/gems/ruby-2.1.2/gems/nokogiri-1.6.5 for inspection.
Results logged to /usr/local/rvm/gems/ruby-2.1.2/extensions/x86_64-darwin-13/2.1.0-static/nokogiri-1.6.5/gem_make.out

推荐答案

这很有魅力!

gem install nokogiri -- --use-system-libraries=true --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/libxml2

https://stackoverflow.com/a/24511149

这篇关于无法安装 Nokogiri gem的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆