1

我遇到了以下错误。当我尝试安装 gem watir 时,下面是 gem install watir 之后的 gems 列表。

我的系统配置是 OS-Windows7(64 位),浏览器是 IE=9

   C:\Users\Farooq>gem list


   *** LOCAL GEMS ***

    bigdecimal (1.2.1, 1.1.0)
    childprocess (0.3.9)
    commonwatir (4.0.0)
    ffi (1.9.0 x86-mingw32)
    io-console (0.4.2, 0.3)
    json (1.8.0, 1.5.5)
    mini_portile (0.5.1)
    minitest (5.0.8, 2.5.1)
    multi_json (1.8.1)
    rake (10.1.0, 0.9.2.2)
    rdoc (4.0.1, 3.9.5)
    rubyzip (1.0.0, 0.9.9)
    selenium-webdriver (2.35.1)
    watir-webdriver (0.6.4)
    websocket (1.1.1, 1.0.7)
    win32-api (1.5.0 universal-mingw32)
    win32-process (0.7.3)
    windows-api (0.4.2)
    windows-pr (1.2.2)enter code here'
    enter code here

当我执行 gem install Watir 时。我收到以下输出错误。

    C:\Users\Farooq>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.

    D:/Ruby193/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=D:/Ruby193/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 D:/Ruby193/lib/ruby/gems/1.9.1/gems/nokogiri-
     1.6.0.rc1 for inspection.
     Results logged to D:/Ruby193/lib/ruby/gems/1.9.1/gems/nokogiri-1.6.0.rc1/ext/nok
     ogiri/gem_make.out

     C:\Users\Farooq>
4

1 回答 1

1
  1. 在 Windows 7 64 位上正确安装 Ruby
  2. 成功安装 Ruby 后,从命令提示符处执行以下命令来安装 watir:

    gem update --system --no-rdoc --no-ri
    gem install watir --no-rdoc --no-ri

您可以点击以下链接了解详情:
http ://www.mytechfetish.com/2013/08/installing-ruby-and-watir-on-windows-7.html

http://www.spritecloud.com/2011/04/complete-setup-guide-for-ruby-cucumber-and-watir-or-selenium-on-windows/

于 2014-12-23T06:56:21.917 回答