安装 nokogiri 的 gem devkit (windows) 时缺少 libxml2

发布于 11-16 18:11 字数 1990 浏览 12 评论 0原文

我在使用这个 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

我能做什么?

I've been experiencing a lot of problems with this gem, so I read that I had to use de 1.5.0-beta.

Since I'm using windows, I downloaded DevKit. But when I ran:

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

I get:

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

What can I do?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

初见你2024-11-23 18:11:18

使用这样的命令,

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

您似乎正在尝试安装最新版本的 nokogiri。尝试使用 --version 指定精确版本。

在 Nokogiri 1.6.0 及更高版本中的以下要求

  • 另请注意,Nokogiri 1.6+ ruby​​ 1.9.3 或更高版本
  • ,libxml2 和 libxslt 不再是要求

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

With a command like

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

it looks like you're trying to install the very latest version of nokogiri. Try specifying a precise version with --version.

Also note the following requirements for nokogiri 1.6+

  • ruby 1.9.3 or higher
  • in Nokogiri 1.6.0 and later, libxml2 and libxslt are no longer requirements

So, if you do want to use ruby 1.8.7 (which is EOL, btw) then, yes, you do need to specify nokogiri < 1.6. However, if you can use a modern, living ruby, then you might dodge the lib dependencies.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文