2

Using

  • Ubuntu 16.04
  • Ruby 2.0.0
  • (gem) cucumber (1.3.20)
  • (gem) cucumber-rails (1.4.2)

Initially I had

Could not find an executable ["phantomjs"] on your path. (Cliver::Dependency::NotFound)

Which was fixed with https://stackoverflow.com/a/31333531/849697

And then

Could not find an executable 'phantomjs' that matched the requirements '>= 1.8.1', '< 3.0'. Found versions were {"/usr/bin/phantomjs"=>"127.0.0.1"}. (Cliver::Dependency::VersionMismatch)

Which bizarrely seems to be giving the ip address where ought to be a version.

phantomjs and phantomjs --version both give

QXcbConnection: Could not connect to display 127.0.0.1:10.0
PhantomJS has crashed. Please read the bug reporting guide at
<http://phantomjs.org/bug-reporting.html> and file a bug report.
[1]    1919 abort (core dumped)  phantomjs --version

(there is no --version in the former)

Community
  • 1
  • 1
xxjjnn
  • 14,591
  • 19
  • 61
  • 94
  • 1
    Strange. Have you tried to install PhantomJS from bitbucket: https://bitbucket.org/ariya/phantomjs/downloads – Artjom B. Jun 06 '16 at 09:14
  • oo that fixed it! I can `--version` it now. And tests are passing. Put as answer? I'm not sure the correct way to install it, but I found the executable in the download and sudo mv'd it to /usr/bin/ overwriting the existing one, and checked chmod permissions – xxjjnn Jun 06 '16 at 10:25
  • Feel free to add the answer yourself and all describe all the necessary steps you took to configure it in your environment. – Artjom B. Jun 06 '16 at 10:31
  • I had to follow https://stackoverflow.com/questions/72496479/phantomjs-launcher-fails-on-latest-pop-os-cannot-find-shared-library-libprovid/72679175#72679175 to fix a related issue :) – xeruf Nov 11 '22 at 00:02

1 Answers1

0

By installing phantomjs directly after downloading from bitbucket, phantomjs --version works, and tests are running and passing as expected.

https://bitbucket.org/ariya/phantomjs/downloads -> download, extract the phantomjs executable file, sudo mv it to overwrite /usr/bin/phantomjs which was installed through sudo apt-get install phantomjs

edit: previously I was doing this workaround:

xvfb-run --auto-servernum bundle exec cucumber

xvfb is a display server, to install sudo apt-get install xvfb

xxjjnn
  • 14,591
  • 19
  • 61
  • 94