问题
C:\DevKit>gem install watir
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing watir:
ERROR: Failed to build gem native extension.
C:/Ruby192/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:/Ruby192/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
--with-libxslt-config
--without-libxslt-config
--with-pkg-config
--without-pkg-config
--with-libxml-2.0-config
--without-libxml-2.0-config
--with-pkg-config
--without-pkg-config
--with-libiconv-config
--without-libiconv-config
--with-pkg-config
--without-pkg-config
Gem files will remain installed in C:/Ruby192/lib/ruby/gems/1.9.1/gems/nokogiri-
1.6.0.rc1 for inspection.
Results logged to C:/Ruby192/lib/ruby/gems/1.9.1/gems/nokogiri-1.6.0.rc1/ext/nok
ogiri/gem_make.out
I am getting this error when try to install watir.please help
回答1:
For some reason your Ruby tries to install pre-release version of Nokogiri, which should not happen usually without explicitly trying to install some. I think it might be related with the Ruby version you're having there.
However, try installing some older version of Nokogiri before installing Watir:
gem install nokogiri -v "1.5.9"
gem install watir
If that does not work, then upgrade your Ruby to 1.9.3 or 2.0.0 instead of 1.9.2 and try again. Don't forget to install DevKit again if you're changing Ruby versions!
回答2:
ERROR: While executing gem ... (Errno::EINVAL) Invalid argument - C:/Ruby193/lib/ruby/gems/1.9.1/gems/mini_magick-3.6.0/tes t/files/special! "chars'.gif – oecprashant
this can be solved by executing gem install mini_magick -v 3.5
then try gem install watir again
回答3:
You need to install the RubyInstaller Development Kit from:
HERE
When you've installed that, Watir would install succesfully.
Put this in your gemfile and do bundle install:
gem "watir", "~> 4.0.2"
That could fix it. But I'm not 100% sure.
回答4:
watir requires nokogiri, and as the error says,
libxml2 is missing. please visit http://nokogiri.org/tutorials/installing_nokog
iri.html for help with installing dependencies.
You should install libxml2 for nokogiri.
You can download it form ftp://xmlsoft.org/libxml2/
nokogiri installation manual: Installing Nokogiri
回答5:
In windows the ruby development environment might occurred some error as XXXX is missing. To download the XXXX is a palliative method. http://railsinstaller.org/ This is my solution for ruby development environment in windows. It may not be the best choice. But I think the railsinstaller would be helpful. The best solution is to migrate to linux or mac.
来源:https://stackoverflow.com/questions/16933872/gem-install-watir-not-working