4

我在使用这个 gem 时遇到了很多问题,所以我读到我必须使用 de 1.5.0-beta。

因为我用的是windows,所以我下载了DevKit。但是当我跑的时候:

gem install nokogiri --pre --with-xml2-lib --with-xslt-lib

我得到:

Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing nokogiri:
        ERROR: Failed to build gem native extension.

        C:/Ruby187/bin/ruby.exe extconf.rb --with-xml2-lib --with-xslt-lib --pla
taform=ruby
*** 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=C:/Ruby187/bin/ruby
        --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-iconv-dir
        --without-iconv-dir
        --with-iconv-include
        --without-iconv-include=${iconv-dir}/include
        --with-iconv-lib
        --without-iconv-lib=${iconv-dir}/lib
        --with-xml2-dir
        --without-xml2-dir
        --with-xml2-include
        --without-xml2-include=${xml2-dir}/include
        --with-xml2-lib=${xml2-dir}/lib
C:/Ruby187/lib/ruby/1.8/mkmf.rb:1177:in `dir_config': private method `split' cal
led for true:TrueClass (NoMethodError)
        from extconf.rb:87


Gem files will remain installed in C:/Ruby187/lib/ruby/gems/1.8/gems/nokogiri-1.
5.0.beta.4 for inspection.
Results logged to C:/Ruby187/lib/ruby/gems/1.8/gems/nokogiri-1.5.0.beta.4/ext/no
kogiri/gem_make.out

我能做些什么?

4

1 回答 1

1

使用类似的命令

gem install nokogiri --pre -- --with-xml2-lib --with-xslt-lib

看起来您正在尝试安装最新版本的 nokogiri。尝试使用--version.

另请注意 nokogiri 1.6+ 的以下要求

  • 红宝石 1.9.3 或更高版本
  • 在 Nokogiri 1.6.0 及更高版本中,不再需要 libxml2 和 libxslt

因此,如果您确实想使用 ruby​​ 1.8.7(即 EOL,顺便说一句),那么,是的,您确实需要指定 nokogiri < 1.6。但是,如果您可以使用现代的、活生生的 ruby​​,那么您可能会避开 lib 依赖项。

于 2013-07-13T18:22:48.667 回答