您好我正在尝试在我的Windows机器上安装开发环境。我已经通过cygwin安装了rubygems。当我运行bundle install时,我在安装nokogiri gem时出错。它说我缺少libxml2。
当我去nokogiri网站时,他们说“gem install nokogiri”应该做我需要的所有窗户。但是,运行它只会给我带来与bundle install相同的错误。
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
答案 0 :(得分:1)
我在Ubuntu 11.04上遇到了同样的错误,并通过安装libxml2-dev
软件包解决了这个问题。
答案 1 :(得分:1)
如果安装了liblxml12-dev
软件包,则无法修复,请尝试安装libxslt-dev
。它解决了mi问题(http://nokogiri.org/tutorials/installing_nokogiri.html)