Rails - 无法安装capybara-webkit

时间:2017-08-03 17:16:54

标签: ruby-on-rails macos qt rspec-rails capybara-webkit

我有一个Rails 5应用程序,它有几个包含在bootstrap模式中的表单。 Capybara在阅读模态内容时遇到了麻烦。从阅读其他几个堆栈溢出文章,似乎我需要安装capybara-webkit gem。但是,我在安装它时遇到了问题。

在我的初始安装中,我收到一条错误消息:

Command 'qmake ' not available

extconf failed, exit code 1

Gem files will remain installed in
/Users/johnseabolt/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/capybara-webkit-1.14.0 for inspection.
Results logged to

An error occurred while installing capybara-webkit (1.14.0), and Bundler cannot continue.
Make sure that `gem install capybara-webkit -v '1.14.0'` succeeds before bundling.

环顾四周,似乎我需要安装QT。所以我尝试使用本文中的说明进行安装:https://github.com/thoughtbot/capybara-webkit/wiki/Installing-Qt-and-compiling-capybara-webkit

我在OS X El Capitan,所以我跑了:

brew install qt@5.5

然后我根据说明将其输入命令行(我相信。这可能是我搞砸的地方):

echo 'export PATH="$(brew --prefix qt@5.5)/bin:$PATH"' >> ~/.bashrc

我再次尝试安装宝石,并得到了完全相同的问题:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory: 
/Users/johnseabolt/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/capybara-webkit-1.14.0
/Users/johnseabolt/.rbenv/versions/2.3.1/bin/ruby -r ./siteconf20170803-82842-1br8b1h.rb extconf.rb
*** 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=/Users/johnseabolt/.rbenv/versions/2.3.1/bin/$(RUBY_BASE_NAME)
--with-gl-dir
--without-gl-dir
--with-gl-include
--without-gl-include=${gl-dir}/include
--with-gl-lib
--without-gl-lib=${gl-dir}/lib
--with-zlib-dir
--without-zlib-dir
--with-zlib-include
--without-zlib-include=${zlib-dir}/include
--with-zlib-lib
--without-zlib-lib=${zlib-dir}/lib
Command 'qmake ' not available

extconf failed, exit code 1

Gem files will remain installed in
/Users/johnseabolt/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/capybara-webkit-1.14.0 for inspection.
Results logged to


An error occurred while installing capybara-webkit (1.14.0), and Bundler cannot continue.
Make sure that `gem install capybara-webkit -v '1.14.0'` succeeds before bundling.

我不能让这个工作?救命啊!

1 个答案:

答案 0 :(得分:0)

使用echo示例,您刚刚将导出添加到.bashrc中 - 您仍然需要确保将其加载到当前PATH环境变量中。最简单的方法是关闭当前的shell并打开一个新的shell,但是我通常发现它更容易与

一起使用
brew link --force qt@5.5

所有这一切,capybara-webkit已经在其JS支持中变得过时,并且需要进行转换和填充以测试大多数现代应用程序。作为使用Capybara测试JS依赖应用程序的初学者,你最好不要使用含铬的硒 - https://github.com/teamcapybara/capybara#configuring-and-adding-drivers -  而不是capybara-webkit

相关问题