可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
I am new to ruby, but while trying to install capybara to run test on my system I get the following error. Im running OSX
my_app$ gem install capybara-webkit Building native extensions. This could take a while... ERROR: Error installing capybara-webkit: ERROR: Failed to build gem native extension. /Users/joe/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb Gem files will remain installed in /Users/joe/.rvm/gems/ruby-1.9.2-p290/gems/capybara-webkit-0.7.2 for inspection. Results logged to /Users/joe/.rvm/gems/ruby-1.9.2-p290/gems/capybara-webkit-0.7.2/./gem_make.out
here are results from gem_make.out
/Users/joe/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb
回答1:
回答2:
Solution for Linux.
Ubuntu
sudo apt-get install libqt4-dev libqtwebkit-dev
Debian Stable
sudo apt-get install libqt4-dev
Fedora
yum install qt-webkit-devel
Fedora 16
yum install qtwebkit-devel
This works for me maybe it will be also helpful for somebody.
回答3:
brew install qt
and then
gem install capybara-webkit -v '0.7.2'
-v 0.7.2 is to select version project is asking you to install. See that installing qt from http://developer.qt.nokia.com/wiki/Support_for_Mac_OS_X requires to set PATH variable.
回答4:
Was having exactly this problem trying to install capybara-webdriver on CentOS 6 after installing QT.
Fixed the problem by adding the following to my PATH environment variable
/usr/lib64/qt4/bin/
回答5:
For OSX, I had to
brew install qt
and then
sudo gem install capybara-webkit -v '0.7.2'
without sudo it would error
回答6:
macOS Sierra 10.12, El Capitan 10.11 and Yosemite 10.10
Install with either homebrew or macports Homebrew
Qt 5.5 is the last version of Qt that capybara-webkit will support. The Qt project has dropped the WebKit bindings from binary releases in 5.6.
Install Qt 5.5 with homebrew:
brew install qt@5.5
The Homebrew formula for qt55 is keg only which means binaries like qmake will not be symlinked into your /usr/local/bin directory and therefore will not be available for capybara-webkit.
To force Homebrew to symlink those binaries into your /usr/local/bin directory you can run:
brew link --force qt55
After running this command you should get the following output:
$ which qmake /usr/local/bin/qmake
Macports
Install qt5 with macports:
sudo port install qt5 qt5-qtwebkit # It's not qt5-mac anymore.
The default location for qt5's qmake is /opt/local/libexec/qt5/bin/qmake. If the qmake on path is different, you can indicate the correct one with QMAKE environment variable.
QMAKE=/opt/local/libexec/qt5/bin/qmake gem install capybara-webkit
回答7:
QT was the answer for me, thougtbot provide a comprehensive installation options here:
https://github.com/thoughtbot/capybara-webkit/wiki/Installing-Qt-and-compiling-capybara-webkit
Generally depending on where you have home brew, this worked for me:
brew update brew install qt gem install capybara-webkit
回答8:
On OSX Mavericks 10.9, qt5 does not install qmake. This post was the only thing that worked for me.
Step 1: Download Qt 5.2.0-beta-1-clang HERE.
Step 2: Install it and include the Src files.
Step 3: Symlink qmake into your /bin directory from the location where you installed Qt. The default location is in your home directory. Open a shell and do something like:
ln -s /Path/to/where/you/installed/Qt5.2/5.2.0-beta1/clang_64/bin/qmake /usr/local/bin/qmake
Then gem install capybara-webkit.
回答9:
I am using Yosemite and following commands has fixed my issue.
brew install qt brew linkapps qt gem install capybara-webkit
回答10:
Here are the complete steps to install Capybara-webkit
in all the OS
Install QT - http://qt-project.org/downloads
brew update brew install qt
ln -s /usr/local/Cellar/qt5/5.4.1/bin/qmake /usr/local/bin/qmake
sudo port install qt4-mac-devel
Reference: Capybara Installation
回答11:
For fedora
yum install qt-webkit-devel export QMAKE=/usr/bin/qmake-qt4 gem install capybara-webkit
回答12:
I was able to get qt and capybara-webkit installed and working on OS X. I had to install Xcode so the build for
gem install capybara-webkit
would finish.
I also set this in my environment
Capybara.javascript_driver = :webkit
brew install qt5
to get latest qt.
The docs for it say that it conflicts with qt4, so be sure to remove that first with
brew uninstall [old qt]
Then it needs to be symlinked with
brew link --force qt5
回答13:
I've got error in my mac OS X 10.12, and this fixed the problem.
brew install qt5 brew link --force qt5 gem install capybara-webkit