在Ruby 2.0.0p353(基于rvm的安装)下安装Nokogiri 1.6.1失败(OSX Mavericks)?

 隔壁老吴 发布于 2023-02-06 21:15

我试图在Ruby和RVM下安装Nokogiri 1.6.1,但是失败了以下错误:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

/Users/lmo0/.rvm/rubies/ruby-2.0.0-p353/bin/ruby extconf.rb 
Extracting libxml2-2.8.0.tar.gz into tmp/x86_64-apple-darwin13.0.0/ports/libxml2/2.8.0... OK
Running 'configure' for libxml2 2.8.0... OK
Running 'compile' for libxml2 2.8.0... OK
Running 'install' for libxml2 2.8.0... OK
Activating libxml2 2.8.0 (from /Users/lmo0/.rvm/gems/ruby-2.0.0-p353/gems/nokogiri-1.6.1/ports/x86_64-apple-darwin13.0.0/libxml2/2.8.0)...
Extracting libxslt-1.1.26.tar.gz into tmp/x86_64-apple-darwin13.0.0/ports/libxslt/1.1.26... OK
Running 'configure' for libxslt 1.1.26... ERROR, review 'tmp/x86_64-apple-darwin13.0.0/ports/libxslt/1.1.26/configure.log' to see what happened.
*** 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
    --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=/Users/lmo0/.rvm/rubies/ruby-2.0.0-p353/bin/ruby
/Users/lmo0/.rvm/gems/ruby-2.0.0-p353/gems/mini_portile-0.5.2/lib/mini_portile.rb:265:in `block in execute': Failed to complete configure task (RuntimeError)
    from /Users/lmo0/.rvm/gems/ruby-2.0.0-p353/gems/mini_portile-0.5.2/lib/mini_portile.rb:257:in `chdir'
    from /Users/lmo0/.rvm/gems/ruby-2.0.0-p353/gems/mini_portile-0.5.2/lib/mini_portile.rb:257:in `execute'
    from /Users/lmo0/.rvm/gems/ruby-2.0.0-p353/gems/mini_portile-0.5.2/lib/mini_portile.rb:65:in `configure'
    from /Users/lmo0/.rvm/gems/ruby-2.0.0-p353/gems/mini_portile-0.5.2/lib/mini_portile.rb:108:in `cook'
    from extconf.rb:101:in `block in 
' from extconf.rb:131:in `call' from extconf.rb:131:in `block in
' from extconf.rb:122:in `tap' from extconf.rb:122:in `
' Gem files will remain installed in /Users/lmo0/.rvm/gems/ruby-2.0.0-p353/gems/nokogiri-1.6.1 for inspection. Results logged to /Users/lmo0/.rvm/gems/ruby-2.0.0-p353/gems/nokogiri-1.6.1/ext/nokogiri/gem_make.out

epylinkn.. 7

检查您的grep版本并安装最新的brew brew:

$ grep --version
grep (BSD grep) 2.5.1-FreeBSD

$ brew install grep --default-names

# If above fails, you probably need to tap
$ brew tap homebrew/dupes
$ brew install grep --default-names

$ grep --version
grep (GNU grep) 2.14.56-1e3d

来自(这个nokogiri问题)[https://github.com/sparklemotion/nokogiri/issues/935]:"OSX的最新版本附带BSD grep,而较旧版本附带GNU grep.那么,你的构建脚本,也许需要GNU grep"

从Maverick的评论中被盗并在此复制作为答案,而不是评论,因为我现在已经多次遇到这个问题,并且希望能够让别人头疼.= X

1 个回答
  • 检查您的grep版本并安装最新的brew brew:

    $ grep --version
    grep (BSD grep) 2.5.1-FreeBSD
    
    $ brew install grep --default-names
    
    # If above fails, you probably need to tap
    $ brew tap homebrew/dupes
    $ brew install grep --default-names
    
    $ grep --version
    grep (GNU grep) 2.14.56-1e3d
    

    来自(这个nokogiri问题)[https://github.com/sparklemotion/nokogiri/issues/935]:"OSX的最新版本附带BSD grep,而较旧版本附带GNU grep.那么,你的构建脚本,也许需要GNU grep"

    从Maverick的评论中被盗并在此复制作为答案,而不是评论,因为我现在已经多次遇到这个问题,并且希望能够让别人头疼.= X

    2023-02-06 21:21 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有