Getting the following error when trying to use phantomjs from ruby on Ubuntu:
Failure/Error: visit root_path
Cliver::Dependency::NotFound:
Could not find an executable ["phantomjs"] on your path.
# ./spec/features/search_spec.rb:17:in `block (2 levels) in <top (required)>'
# ./spec/support/vcr.rb:23:in `block (3 levels) in <top (required)>'
# ./spec/support/vcr.rb:23:in `block (2 levels) in <top (required)>'
phantomjs was built locally and added to PATH. How do I make ruby find phantomjs?
Instead of building locally, use homebrew on your mac with
brew install phantomjs
and all the paths will link after. I had this error myself, and you'll get the links for free and have the ability to update easily.add to Gemfile
or put code below to spec_helper.rb
https://github.com/colszowka/phantomjs-gem
Other possible solution is to add executable rights to file:
And also it is not recommended by poltergeist to use
phantomjs
from official Ubuntu repos:For
Mac Os El Capitan
use following command:Above command only works if you have installed
npm
, for installingnpm
:You can also do
That should automatically add phantomjs to your path, and do everything else necessary for it to run correctly. This worked for me.
Apparently, the solution was to add phantomjs not only to the PATH, but also create links:
Adjust the
/home/myuser/phantomjs/bin/phantomjs
paths to match the path to phantomjs binary on your machine.