Some time ago I came across a weird error when trying to run RSpec test suite involving PhantomJS in Vagrant. Here’s the solution.
The error in question is:
The detector #{@detector} failed to detect the version of the executable at '#{executable_path}
Here is the snipped of the failures:
139.3) Failure/Error:
raw_version || raise(ArgumentError,
"The detector #{@detector} failed to detect the" +
"version of the executable at '#{executable_path}'")
ArgumentError:
The detector <struct Cliver::Detector command_arg=nil, version_pattern=nil> failed to detect theversion of the executable at '/usr/bin/phantomjs'
140) Document details management when visiting index secret_admin can see it
Got 0 failures and 3 other errors:
140.1) Failure/Error: visit new_user_session_path
ArgumentError:
The detector <struct Cliver::Detector command_arg=nil, version_pattern=nil> failed to detect theversion of the executable at '/usr/bin/phantomjs'
What helped me to fix it in the end was setting the QT_QPA_PLATFORM
variable to offscreen
:
vagrant$ QT_QPA_PLATFORM=offscreen rspec
You should also be able to pass the -platform offscreen
option to the PhantomJS executable.
Check out my book
Deployment from Scratch is unique Linux book about web application deployment. Learn how deployment works from the first principles rather than YAML files of a specific tool.