在Windows 7上安装watir gem时出错

时间:2013-05-29 15:42:11

标签: ruby watir devkit

我搜索了整个stackoverflow以获得有关如何成功安装watir的具体答案,但我无法安装它。我得到了同样的错误,我相信其他人也有。但我无法解决它。有人可以帮我解决这个问题吗?

步骤:

安装Ruby - ruby​​installer-1.9.3-p429.exe

安装DevKit(路径:C:\ DevKit) - DevKit-tdm-32-4.5.2-20111229-1559-sfx.exe(我已经安装并尝试了所有其他版本)

在cmd上:

C:\DevKit\ruby dk.rb init
C:\DevKit\ruby dk.rb install
C:\DevKit\gem update --system

gem版本更新到2.0.3

安装watir:

C:\DevKit\gem install watir --no-ri --no-rdoc

我收到以下错误:

Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
The system cannot find the path specified.
ERROR:  Error installing watir:
        ERROR: Failed to build gem native extension.

    C:/Ruby193/bin/ruby.exe extconf.rb
checking for libxml/parser.h... *** 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:/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
C:/Ruby193/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to genera
te an executable file. (RuntimeError)
You have to install development tools first.
        from C:/Ruby193/lib/ruby/1.9.1/mkmf.rb:506:in `try_cpp'
        from C:/Ruby193/lib/ruby/1.9.1/mkmf.rb:970:in `block in find_header'
        from C:/Ruby193/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
        from C:/Ruby193/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postp
one'
        from C:/Ruby193/lib/ruby/1.9.1/mkmf.rb:254:in `open'
        from C:/Ruby193/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
        from C:/Ruby193/lib/ruby/1.9.1/mkmf.rb:254:in `open'
        from C:/Ruby193/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
        from C:/Ruby193/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
        from C:/Ruby193/lib/ruby/1.9.1/mkmf.rb:969:in `find_header'
        from extconf.rb:166:in `<main>'


Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/nokogiri-
1.6.0.rc1 for inspection.
Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/gems/nokogiri-1.6.0.rc1/ext/nok
ogiri/gem_make.out

1 个答案:

答案 0 :(得分:1)

试试这个

C:\DevKit\gem install watir --system