2017-08-03 312 views
1

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

在我最初的安装,我得到了一个错误,说:

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 [email protected] 

然后我打这个进入命令行,每个指令(我。相信这可能是在那里我搞砸了):

​​

我尝试安装宝石一遍,得到了确切的同样的问题:

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. 

我无法得到此结果?帮帮我!

回答

0

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

brew link --force [email protected] 

去所有这一切是说,capybara-webkit已经成为了JS很过时支持并需要用于测试大多数现代应用程序的转译和填充。作为使用水豚测试依赖JS的应用程序的初学者,你可能更适合使用含铬的硒 - https://github.com/teamcapybara/capybara#configuring-and-adding-drivers - 而不是capybara-webkit