当我运行bundle install
时,我收到以下错误:
Using activeresource (3.0.3)
Installing libxml-ruby (1.1.4) with native extensions C:/RailsInstaller/Ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/installer.rb:529:in `build_extensions': ERROR: Failed to build gem native extension. (
Gem::Installer::ExtensionBuildError)
C:/RailsInstaller/Ruby1.8.7/bin/ruby.exe extconf.rb
checking for socket() in -lsocket... no
checking for gethostbyname() in -lnsl... no
checking for atan() in -lm... yes
checking for inflate() in -lz... no
checking for inflate() in -lzlib... no
checking for inflate() in -lzlib1... yes
checking for iconv_open() in -liconv... no
checking for libiconv_open() in -liconv... yes
checking for xmlParseDoc() in -lxml2... yes
checking for libxml/xmlversion.h... no
checking for libxml/xmlversion.h in /opt/include/libxml2,/usr/local/include/libxml2,/usr/include/libxml2... no extconf failure: need libxml2.
Install the library or try one of the following options to extconf.rb:
--with-xml2-config=/path/to/xml2-config
--with-xml2-dir=/path/to/libxml2
--with-xml2-lib=/path/to/libxml2/lib
--with-xml2-include=/path/to/libxml2/include
我明白缺少什么,但我不明白如何解决这个问题。提前致谢。
答案 0 :(得分:2)
我在Windows上有类似的问题,以下命令有效。
gem install libxml-ruby -- --with-xml2-include=C:\ruby-1.9.2\include\libxml2
但是,请注意,为此,您应该已在指定的路径中使用libxml2程序集,并且不要使用带空格或引号的路径。
答案 1 :(得分:0)
我也试过在Windows上运行Rails并记得遇到这个问题,但是不记得我做了什么,但是快速谷歌搜索找到了这个链接:http://gnuwin32.sourceforge.net/packages/libxml2.htm
告诉您如何为Windows下载libxml2。