在窗户上安装Nokogiri宝石

时间:2014-06-13 08:38:33

标签: ruby-on-rails ruby windows nokogiri

我试图在我的Windows环境中安装Ruby。它在我的Ubuntu上工作正常。

我按照此处的说明操作:https://github.com/oneclick/rubyinstaller/wiki/Development-Kit

Ruby 2.0似乎已正确设置,包括DevKit和RubyInstaller。

但是当我尝试bundle时,请获取以下内容:

gem install nokogiri -v '1.5.11'
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:/Ruby/RubyInstaller200-x64/bin/ruby.exe extconf.rb
Le chemin d'accès spécifié est introuvable.
checking for libxml/parser.h... no
-----
libxml2 is missing.  please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.
-----
*** 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:/Ruby/RubyInstaller200-x64/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
        --without-xml2-lib=${xml2-dir}/lib
        --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-libxml-2.0-config
        --without-libxml-2.0-config
        --with-pkg-config
        --without-pkg-config
        --with-libiconv-config
        --without-libiconv-config
        --with-pkg-config
        --without-pkg-config


Gem files will remain installed in C:/Ruby/RubyInstaller200-x64/lib/ruby/gems/2.0.0/gems/nokogiri-1.5.11 for inspection.
Results logged to C:/Ruby/RubyInstaller200-x64/lib/ruby/gems/2.0.0/gems/nokogiri-1.5.11/ext/nokogiri/gem_make.out

我已经安装了这个gem,但是在另一个版本中。

C:\wamp\www\holdsport>gem list | grep noko              
nokogiri (1.6.2.1 x64-mingw32)

似乎没有安装libxml2,但我无法了解如何在Windows上安装它。 我不知道消息extconf.rb failed是因为缺少libxml2还是其他问题。

知道它为什么不起作用?

1 个答案:

答案 0 :(得分:4)

Nokogiri无论出于何种原因都不支持x64 ruby​​ 2.0。请尝试安装x86版本的ruby。

如果gem install nokogiri 无法正常工作,请使用gem install nokogiri --pre安装预发行版。