我在搜索类似问题时发现Nokogiri尚不支持Ruby 2.0的 x64 支持。但是,虽然我在Windows x64机器上,但我的 Ruby 版本是来自 railsinstaller.org (with Rails 3.2.13) 的 ruby 1.9.3p392 (2013-02-22) [i386-mingw32]。这也意味着DevKit已经安装。
gem install nokogiri --pre给出了这个错误:
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:/RailsInstaller/Ruby1.9.3/bin/ruby.exe extconf.rb
checking for libxml/parser.h... no
-----
libxml2 is missing. please visit http://nokogiri.org/tutorials/installing_nokog
iri.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:/RailsInstaller/Ruby1.9.3/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
虽然gem install nokogiri --pre -- --with-xml2-lib --with-xslt-lib --platform=ruby会引发此错误:
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:/RailsInstaller/Ruby1.9.3/bin/ruby.exe extconf.rb --with-xml2-lib --wi
th-xslt-lib --platform=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:/RailsInstaller/Ruby1.9.3/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:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:1544:in `dir_config': undefin
ed method `split' for true:TrueClass (NoMethodError)
from extconf.rb:147:in `<main>'
我无法通过 SO/google groups/blogs/etc 找到任何具体解决方案,有吗?
这是我的路径:
PATH=C:\RailsInstaller\Git\cmd;C:\RailsInstaller\Ruby1.9.3\bin;C:\windows;C:\win
dows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\Program Files(
x86)\Git\cmd;C:\Program Files\nodejs\;C:\cygwin\bin;C:\mingw64\x86_64-w64-mingw3
2\bin;C:\mingw64\bin;C:\Program Files (x86)\Heroku\bin;C:\Program Files (x86)\gi
t\cmd;C:\Users\Joshua\AppData\Roaming\npm;C:\mingw64\x86_64-w64-mingw32\bin;C:\P
rogram Files\PostgreSQL\9.2\bin;
我还尝试从http://linux.softpedia.com/progDownload/libxml2-Download-162.html下载 libxml2并将内容放入 C:\RailsInstaller\Ruby1.9.3\lib 以及 C:\RailsInstaller\DevKit \lib 但我收到了同样的错误。
tl; dr 似乎有两个不同的错误,具体取决于我通过的选项。parser.h 错误和 TrueClass 'split' 错误。