安装nokogiri的gem devkit时缺少libxml2(Windows) [英] libxml2 missing when installing nokogiri's gem devkit (windows)
问题描述
我在使用这个gem时遇到了很多问题,因此我读到必须使用de 1.5.0-beta.
I've been experiencing a lot of problems with this gem, so I read that I had to use de 1.5.0-beta.
由于我使用Windows,因此下载了DevKit.但是当我跑步时:
Since I'm using windows, I downloaded DevKit. But when I ran:
gem安装nokogiri --pre---with-xml2-lib --with-xslt-lib
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
我该怎么办?
推荐答案
使用类似
gem install nokogiri --pre -- --with-xml2-lib --with-xslt-lib
您似乎正在尝试安装最新版本的nokogiri.尝试使用--version
指定精确版本.
it looks like you're trying to install the very latest version of nokogiri. Try specifying a precise version with --version
.
还请注意以下有关nokogiri 1.6+的要求
Also note the following requirements for nokogiri 1.6+
- 红宝石1.9.3或更高版本
- 在Nokogiri 1.6.0和更高版本中,不再需要libxml2和libxslt
因此,如果您确实想使用ruby 1.8.7(即EOL,顺便说一句),是的,您确实需要指定nokogiri< 1.6.但是,如果您可以使用现代的活红宝石,则可以避开lib依赖项.
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.
这篇关于安装nokogiri的gem devkit时缺少libxml2(Windows)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!