I have a Rails 5 application that has several forms contained in bootstrap modals. Capybara is having trouble reading the modal content. From reading several other stack overflow articles, it seems I need to install the capybara-webkit gem. However, I am having trouble installing it.
On my initial install, I got an error that said:
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.
Looking around a bit, it seems I need to install QT. So I tried to install using the instructions from this article: https://github.com/thoughtbot/capybara-webkit/wiki/Installing-Qt-and-compiling-capybara-webkit
I am on OS X El Capitan, so I ran:
brew install qt#5.5
Then I typed this into the command line, per the instructions (I believe. This may be where I messed up):
echo 'export PATH="$(brew --prefix qt#5.5)/bin:$PATH"' >> ~/.bashrc
I tried installing the gem again, and got the exact same problem:
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.
I can't get this working? Help!
With the echo example you've just added the export to your .bashrc - You still need to make sure that is loaded into the current PATH environment variable though. Easiest way to do that is to close the current shell and open a new one, however I've generally found it easier to just go with the
brew link --force qt#5.5
All this being said, capybara-webkit has become pretty outdated in its JS support and requires transpiling and polyfilling for testing most modern apps. As a beginner to testing JS dependent apps with Capybara you're probably better off using selenium with chrome - https://github.com/teamcapybara/capybara#configuring-and-adding-drivers -
instead of capybara-webkit
Related
I'm trying to install a Rails 5 app in my Macbook Air with M1 chip. This app is using a gem called potracer.
After doing $ bundle install I get the error:
Installing potracer 1.1.4 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /Users/user/.rvm/gems/ruby-2.7.2/gems/potracer-1.1.4/ext/potracer
/Users/user/.rvm/rubies/ruby-2.7.2/bin/ruby -I /Users/user/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0 -r ./siteconf20211025-1533-nnxnj9.rb extconf.rb
checking for potracelib.h... no
potracelib.h not found
*** 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
--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/user/.rvm/rubies/ruby-2.7.2/bin/$(RUBY_BASE_NAME)
--with-potrace-dir
--without-potrace-dir
--with-potrace-include
--without-potrace-include=${potrace-dir}/include
--with-potrace-lib
--without-potrace-lib=${potrace-dir}/lib
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/user/.rvm/gems/ruby-2.7.2/extensions/arm64-darwin-20/2.7.0/potracer-1.1.4/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Users/user/.rvm/gems/ruby-2.7.2/gems/potracer-1.1.4 for inspection.
Results logged to /Users/user/.rvm/gems/ruby-2.7.2/extensions/arm64-darwin-20/2.7.0/potracer-1.1.4/gem_make.out
An error occurred while installing potracer (1.1.4), and Bundler cannot continue.
Make sure that `gem install potracer -v '1.1.4' --source 'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
potracer
I had other issues installing other rails app with the M1 chip but I found workarounds but not in this case.
Ideas on how to solved this?
You have to reinstall potrace loccaly before. The installation seems to be incomplete.
you would need the library/headers installed. Depending on your platform it would be something like libpotrace and libpitrace-dev.
You would install them via homebrew, apt, dnf, etc.
The potrace execution will abort unless you get the potrace.h locally
abort potracelib.h not found' unless find_header('potracelib.h')
require 'mkmf'
RbConfig::MAKEFILE_CONFIG['CC'] = ENV['CC'] if ENV['CC']
LIBDIR = RbConfig::CONFIG['libdir']
INCLUDEDIR = RbConfig::CONFIG['includedir']
HEADER_DIRS = ['/opt/local/include', '/usr/local/include', INCLUDEDIR,
'/usr/include']
LIB_DIRS = ['/opt/local/lib', '/usr/local/lib', LIBDIR, '/usr/lib']
dir_config('potrace', HEADER_DIRS, LIB_DIRS)
abort 'potracelib.h not found' unless find_header('potracelib.h')
abort 'lib potrace not found' unless find_library('potrace', 'potrace_version')
create_header
create_makefile('potracer/potracer')
Source: https://github.com/kennyp/potracer/blob/b67d3ff6a1ae672ccc6701fa5245fa532b461ef3/ext/potracer/extconf.rb
I am trying to run my rails server. When I first ran, I got an error like this
No timezone data source could be found. To resolve this, either install TZInfo:
I resolve the error by updating the x64 version of tzinfo-data in the gem file. After that when I ran bundle update, I am getting the following error
* 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:/Ruby24-x64/bin/$(RUBY_BASE_NAME)
--with-libxml2-config
--without-libxml2-config
--with-pkg-config
--without-pkg-config extconf.rb:29:in `': The "libxml2" package isn't available. (RuntimeError)
To see why this extension failed to compile, please check the mkmf.log
which can be found here:
C:/Ruby24-x64/lib/ruby/gems/2.4.0/extensions/x64-mingw32/2.4.0/ovirt-engine-sdk-4.3.0/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/ovirt-engine-sdk-4.3.0 for
inspection. Results logged to
C:/Ruby24-x64/lib/ruby/gems/2.4.0/extensions/x64-mingw32/2.4.0/ovirt-engine-sdk-4.3.0/gem_make.out
An error occurred while installing ovirt-engine-sdk (4.3.0), and
Bundler cannot continue. Make sure that gem install ovirt-engine-sdk
-v '4.3.0' --source 'https://rubygems.org/' succeeds before bundling.
In Gemfile: fog was resolved to 2.1.0, which depends on
fog-ovirt was resolved to 1.1.6, which depends on
ovirt-engine-sdk
What could have possibly gone wrong? How to resolve this in Windows machines?
I know this might not be a good answer for you, but running Ruby on Rails on windows is a pain, and going to be terrible experience, try to set a dual boot with Ubuntu, Debian or any other linux distribution along side with windows and then you can develop with RoR as it should.
I couldn't bundle since there was an error occurred while installing capybara-webkit (1.11.1).
So I tried gem install capybara-webkit -v '1.11.1', but it returned en error: Failed to build gem native extension. I'm not even sure what does it mean.
The entire output would be:
Building native extensions. This could take a while...
ERROR: Error installing capybara-webkit:
ERROR: Failed to build gem native extension.
current directory: ...
*** 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=...
--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 ' ' not available
extconf failed, exit code 1
Gem files will remain installed in .../capybara-webkit-1.11.1 for inspection.
Results logged to .../capybara-webkit-1.11.1/gem_make.out
Does anyone know how to handle this issue?
Thank you in advance!
The answer posted by #raghu will work with Qt5.5 which is the last version officially supported by the developers of capybara-webkit. Another option is to make homebrew install qt-webkit with the current version of qt and then build capybara-webkit against that. Start by uninstalling qt from homebrew if you've already installed it (brew uninstall qt), then
brew install qt --with-qtwebkit
and go do something else for a while as it compiles from source. Once it's finished try installing the capybara-webkit gem again.
Try this:
brew install qt#5.5
brew link --force qt#5.5
gem install capybara-webkit
You can further check here: https://github.com/thoughtbot/capybara-webkit/wiki/Installing-Qt-and-compiling-capybara-webkit#macos-sierra-1012-el-capitan-1011-and-yosemite-1010
I've tried multiple solutions offered on similar question posted here but nothing seems to work. I can't install Rails. Error message is below. Also, Wwen I try to install Xcode by using xcode-select --install, it give me an installation o network cannot download due to network Please advise. I'm very new to Ruby so any assistance would be greatly appreciated. Cheers.
nmacaule-mn1:~ nmacaule$ gem install rails --no-ri --no-rdoc
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/Users/nmacaule/.rvm/rubies/ruby-2.2.0/bin/ruby -r ./siteconf20150209-56320-1m9byas.rb extconf.rb
checking if the C compiler accepts ... yes
checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future... no
Building nokogiri using packaged libraries.
-----
The file "/usr/include/iconv.h" is missing in your build environment,
which means you haven't installed Xcode Command Line Tools properly.
To install Command Line Tools, try running `xcode-select --install` on
terminal and follow the instructions. If it fails, open Xcode.app,
select from the menu "Xcode" - "Open Developer Tool" - "More Developer
Tools" to open the developer site, download the installer for your OS
version and run it.
-----
*** 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
--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/nmacaule/.rvm/rubies/ruby-2.2.0/bin/$(RUBY_BASE_NAME)
--help
--clean
--use-system-libraries
--enable-static
--disable-static
--with-zlib-dir
--without-zlib-dir
--with-zlib-include
--without-zlib-include=${zlib-dir}/include
--with-zlib-lib
--without-zlib-lib=${zlib-dir}/lib
--enable-cross-build
--disable-cross-build
extconf failed, exit code 1
Gem files will remain installed in /Users/nmacaule/.rvm/gems/ruby-2.2.0/gems/nokogiri-1.6.6.2 for inspection.
Results logged to /Users/nmacaule/.rvm/gems/ruby-2.2.0/extensions/x86_64-darwin-13/2.2.0/nokogiri-1.6.6.2/gem_make.out
Run this command:
xcode-select --install
I'm new to Ruby on Rails, and I'm getting the below error when I'm installing it.
Please note, I have installed the latest Xcode and installed command line tools, and I'm using OSX 10.8.4. I've installed Ruby 2.0.0 as well.
-bash-3.2$ sudo gem install rails
Password:
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/Users/WillieTran/.rvm/rubies/ruby-2.0.0-p247/bin/ruby 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/WillieTran/.rvm/rubies/ruby-2.0.0-p247/bin/ruby
--with-atomic_reference-dir
--without-atomic_reference-dir
--with-atomic_reference-include
--without-atomic_reference-include=${atomic_reference-dir}/include
--with-atomic_reference-lib
--without-atomic_reference-lib=${atomic_reference-dir}/
/Users/WillieTran/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:434:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Users/WillieTran/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:519:in `try_link0'
from /Users/WillieTran/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:817:in `try_run'
from extconf.rb:24:in `<main>'
Gem files will remain installed in /Users/WillieTran/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0/gems/atomic-1.1.12 for inspection.
Results logged to /Users/WillieTran/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0/gems/atomic-1.1.12/ext/gem_make.out
I had similar problem and it gets solved by installing command line tools:
xcode-select --install
The symlinking did not solve the problem for me. I uninstalled my ruby that I previously had installed using rvm by typing rvm uninstall ruby-2.0.0 and then I typed rvm requirements. This command found that I needed a few other things, such as gcc46. It's strange that the gcc compiler was needed, even though I had installed the xcode command line tools, and gcc was most definitely installed on my system.
So, if none of the usual methods are working, give rvm requirements a shot!
I guess it's a same problem with this question.
Try sudo ln -s /usr/bin/{llvm-,}gcc-4.2 and gem install rails again.
By the way, you're in your own home directory, you don't have to use sudo.
I just ran into this with ruby 2.5.3 and was able to install cairo by calling:
PKG_CONFIG_PATH=/usr/local/opt/libffi/lib/pkgconfig gem install cairo -v '1.15.2'
Took a while to find something that worked, as I already had the command line tools installed, and am using asdf not rvm.
Thanks to this thread for helping with the fix: https://github.com/ruby-gnome2/ruby-gnome2/issues/259#issuecomment-59751807