2014-06-13 153 views
0

我想在我的Windows環境下安裝Ruby。它在我的Ubuntu上正常工作。在窗口上安裝Nokogiri寶石

我按照說明在這裏:https://github.com/oneclick/rubyinstaller/wiki/Development-Kit

紅寶石2.0似乎是正確設置,兩者的devkit和RubyInstaller。

但是,當我嘗試bundle IG得到如下:

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 

我已經安裝了這種寶石,但在另一個版本。

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

好像libxml2沒有安裝,但我找不到如何在Windows上安裝它。 我不知道消息extconf.rb failed是因爲libxml2丟失還是另一個問題。

任何想法爲什麼它不工作?

+0

你使用了RubyInstaller for Windows(http://rubyinstaller.org/)? – bdares

+0

是的,我做了,https://github.com/oneclick/rubyinstaller/wiki/Development-Kit – Vadorequest

回答

4

無論出於何種原因,Nokogiri不支持x64 ruby​​ 2.0。嘗試安裝x86版本的ruby代替。

如果gem install nokogiri仍然不起作用,請安裝預發行版gem install nokogiri --pre

+0

謝謝你幫我理解這個問題。安裝--pre版本將無濟於事,因爲它是另一個gem的依賴。由於只有一顆寶石,我對使用x86版本有點懷疑。 – Vadorequest

+0

這是Windows上唯一適用於我的東西。我使用DevKit安裝了Ruby 2.1.5,但無法正常安裝。謝謝。 – DavidC