2017-08-03 300 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