简体   繁体   English

gem install watir不工作

[英]gem install watir not working

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 我在尝试安装watir.please帮助时遇到此错误

For some reason your Ruby tries to install pre-release version of Nokogiri, which should not happen usually without explicitly trying to install some. 出于某种原因,你的Ruby试图安装Nokogiri的预发布版本,这通常不会在没有明确尝试安装的情况下发生。 I think it might be related with the Ruby version you're having there. 我认为它可能与你在那里的Ruby版本有关。

However, try installing some older version of Nokogiri before installing Watir: 但是,在安装Watir之前,请尝试安装一些旧版本的Nokogiri:

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. 如果这不起作用,那么将Ruby升级到1.9.3或2.0.0而不是1.9.2,然后再试一次。 Don't forget to install DevKit again if you're changing Ruby versions! 如果您要更改Ruby版本,请不要忘记再次安装DevKit!

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! 错误:执行gem时...(Errno :: EINVAL)参数无效 - C:/Ruby193/lib/ruby/gems/1.9.1/gems/mini_magick-3.6.0/tes t / files / special! "chars'.gif – oecprashant “chars'.gif - oecprashant

this can be solved by executing gem install mini_magick -v 3.5 这可以通过执行gem install mini_magick -v 3.5来解决

then try gem install watir again 然后再次尝试gem install watir

You need to install the RubyInstaller Development Kit from: 您需要从以下位置安装RubyInstaller Development Kit:

HERE 这里

When you've installed that, Watir would install succesfully. 安装完成后,Watir会成功安装。


Put this in your gemfile and do bundle install: 把它放在你的gemfile中并进行bundle install:

gem "watir", "~> 4.0.2"

That could fix it. 这可以解决它。 But I'm not 100% sure. 但我不是百分百肯定。

watir requires nokogiri, and as the error says, watir需要nokogiri,正如错误所说,

libxml2 is missing. please visit http://nokogiri.org/tutorials/installing_nokog
iri.html for help with installing dependencies.

You should install libxml2 for nokogiri. 您应该为nokogiri安装libxml2。
You can download it form ftp://xmlsoft.org/libxml2/ 你可以从ftp://xmlsoft.org/libxml2/下载它

nokogiri installation manual: Installing Nokogiri nokogiri安装手册: 安装Nokogiri

In windows the ruby development environment might occurred some error as XXXX is missing. 在Windows中,ruby开发环境可能会因缺少XXXX而出现一些错误。 To download the XXXX is a palliative method. 下载XXXX是一种姑息性的方法。 http://railsinstaller.org/ This is my solution for ruby development environment in windows. http://railsinstaller.org/这是我在windows中的ruby开发环境的解决方案。 It may not be the best choice. 它可能不是最好的选择。 But I think the railsinstaller would be helpful. 但我认为railsinstaller会有所帮助。 The best solution is to migrate to linux or mac. 最好的解决方案是迁移到linux或mac。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM