Could not find phantomjs

Sergey Evstifeev picture Sergey Evstifeev · Jun 8, 2015 · Viewed 21.6k times · Source

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?

Answer

Matthew picture Matthew · Jul 10, 2015

You can also do

$ sudo apt-get install phantomjs                               

That should automatically add phantomjs to your path, and do everything else necessary for it to run correctly. This worked for me.