嗨,我正试图在我的windows机器上设置一个开发环境。我已经通过cygwin安装了rubygems。当我运行捆绑包安装时,我在安装nokogiri gem时遇到了一个错误。它说我缺少libxml2。
当我去nokogiri网站时,他们说"geminstall nokogili"应该为windows做我需要的一切。然而,运行它只会给我带来与捆绑包安装相同的错误。
Installing nokogiri (1.4.4) with native extensions /usr/lib/ruby/site_ruby/1.8/r
ubygems/installer.rb:543:in `build_extensions': ERROR: Failed to build gem nativ
e extension. (Gem::Installer::ExtensionBuildError)
/usr/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
$
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/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
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/nokogiri-1.4.4 fo
r inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/nokogiri-1.4.4/ext/nokogiri/gem_ma
ke.out
from /usr/lib/ruby/site_ruby/1.8/rubygems/installer.rb:496:in `each'
from /usr/lib/ruby/site_ruby/1.8/rubygems/installer.rb:496:in `build_ext
ensions'
from /usr/lib/ruby/site_ruby/1.8/rubygems/installer.rb:177:in `install'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/source.rb:10
1:in `install'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/rubygems_int
egration.rb:279:in `preserve_paths'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/source.rb:91
:in `install'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/installer.rb
:58:in `run'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/rubygems_int
egration.rb:93:in `with_build_args'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/installer.rb
:57:in `run'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/spec_set.rb:
12:in `each'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/spec_set.rb:
12:in `each'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/installer.rb
:49:in `run'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/installer.rb
:8:in `install'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/cli.rb:270:i
n `update'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/vendor/thor/
task.rb:22:in `send'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/vendor/thor/
task.rb:22:in `run'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/vendor/thor/
invocation.rb:118:in `invoke_task'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/vendor/thor.
rb:246:in `dispatch'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/vendor/thor/
base.rb:389:in `start'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/bin/bundle:13
from /usr/bin/bundle:19:in `load'
from /usr/bin/bundle:19
我在Ubuntu 11.04上遇到了同样的错误,并通过安装libxml2-dev
软件包解决了这个问题。
如果安装liblxml12-dev
程序包无法修复,请尝试安装libxslt-dev
。它解决了我的问题(http://nokogiri.org/tutorials/installing_nokogiri.html)