I've followed the instructions on Poltergeist github page but i keep getting an error that my PhantomJS version is wrong.
Specifically, it says:
Could not find an executable 'phantomjs' that matched the requirements '~> 1.8', '>= 1.8.1'. Found versions were {"/home/marko/projects/irs_machine/bin/phantomjs"=>"50"}.
Now, I have downloaded phantomjs v1.8.1 (and later v1.9.2) so the version is correct. This is really driving me crazy. I use Ubuntu 13.04, but I doubt that's the reason.
Googling for the error returns nothing of use.
Any ideas?
I've solved it!
What I found to be very strange was the fact that the error reported the phantomjs version to be "50" which is impossible.
I've tracked the error down to the "cliver" gem, a gem that detects versions of installed programs. It does so by regex matching the desired version string to the result of
{command} -v
Now, when I run phantomjs -v i get "1.8.1", so what was happening? On closer inspection "1.8.1" wasn't all that I was getting back! To be precise, I got this:
phantomjs -v
Fontconfig warning: "/etc/fonts/conf.d/50-user.conf", line 9: reading configurations from ~/.fonts.conf is deprecated.
1.8.1
I had a fontconf error, and sure enough, the first number it contained was "50". Cliver matches against standard output, so it couldn't get a proper version because the system was writing errors out.
Once I reconfigured the 50-user.conf not to use line 9, the error was gone and poltergeist started working as expected.
In my case, using apt-get
to install PhantomJS was installing an older version of PhantomJS. I had to manually install PhantomJS by downloading the tarball, unpacking it, and creating links to the executable in /bin
:
apt-get
, the command for me was sudo apt-get remove phantomjs
.wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.7-linux-x86_64.tar.bz2
to download the x86 version of PhantomJS 1.9.7 from the command lineto the current working directory.)tar xjf phantomjs-1.9.7-linux-x86_64.tar.bz2
, depending on which version you downloaded.phantomjs
executable in your /bin
.
sudo ln -s <snip>/<unpacked_tarball>/bin/phantomjs /usr/local/share/phantomjs
sudo ln -s <snip>/<unpacked_tarball>/bin/phantomjs /usr/local/bin/phantomjs
sudo ln -s <snip>/<unpacked_tarball>/bin/phantomjs /usr/bin/phantomjs
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With