Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PhantomJS Error: 'QXcbConnection: Could not connect to display' #638

Open
1000miles opened this issue Jul 19, 2017 · 0 comments
Open

PhantomJS Error: 'QXcbConnection: Could not connect to display' #638

1000miles opened this issue Jul 19, 2017 · 0 comments
Labels

Comments

@1000miles
Copy link
Collaborator

1000miles commented Jul 19, 2017

When trying to run the specs we get a lot of errors due to phantomjs.

Example (corrected)

69.2) 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'
            # /home/ubuntu/bundle/ruby/2.2.0/gems/cliver-0.3.2/lib/cliver/dependency.rb:191:in `detect_version'
            # /home/ubuntu/bundle/ruby/2.2.0/gems/cliver-0.3.2/lib/cliver/dependency.rb:87:in `block in installed_versions'
            # /home/ubuntu/bundle/ruby/2.2.0/gems/cliver-0.3.2/lib/cliver/dependency.rb:214:in `block in find_executables'
            # /home/ubuntu/bundle/ruby/2.2.0/gems/cliver-0.3.2/lib/cliver/dependency.rb:208:in `map'
            # /home/ubuntu/bundle/ruby/2.2.0/gems/cliver-0.3.2/lib/cliver/dependency.rb:208:in `find_executables'
            # /home/ubuntu/bundle/ruby/2.2.0/gems/cliver-0.3.2/lib/cliver/dependency.rb:86:in `each'
            # /home/ubuntu/bundle/ruby/2.2.0/gems/cliver-0.3.2/lib/cliver/dependency.rb:86:in `installed_versions'
            # /home/ubuntu/bundle/ruby/2.2.0/gems/cliver-0.3.2/lib/cliver/dependency.rb:108:in `each'
            # /home/ubuntu/bundle/ruby/2.2.0/gems/cliver-0.3.2/lib/cliver/dependency.rb:108:in `detect!'
            # /home/ubuntu/bundle/ruby/2.2.0/gems/cliver-0.3.2/lib/cliver.rb:24:in `detect!'
            # /home/ubuntu/bundle/ruby/2.2.0/gems/poltergeist-1.9.0/lib/capybara/poltergeist/client.rb:36:in `initialize'
            # /home/ubuntu/bundle/ruby/2.2.0/gems/poltergeist-1.9.0/lib/capybara/poltergeist/client.rb:14:in `new'
            # /home/ubuntu/bundle/ruby/2.2.0/gems/poltergeist-1.9.0/lib/capybara/poltergeist/client.rb:14:in `start'
            # /home/ubuntu/bundle/ruby/2.2.0/gems/poltergeist-1.9.0/lib/capybara/poltergeist/driver.rb:42:in `client'
            # /home/ubuntu/bundle/ruby/2.2.0/gems/poltergeist-1.9.0/lib/capybara/poltergeist/driver.rb:25:in `browser'
            # /home/ubuntu/bundle/ruby/2.2.0/gems/poltergeist-1.9.0/lib/capybara/poltergeist/driver.rb:177:in `reset!'
            # /home/ubuntu/bundle/ruby/2.2.0/gems/capybara-2.6.2/lib/capybara/session.rb:108:in `reset!'
            # /home/ubuntu/bundle/ruby/2.2.0/gems/capybara-2.6.2/lib/capybara.rb:285:in `block in reset_sessions!'
            # /home/ubuntu/bundle/ruby/2.2.0/gems/capybara-2.6.2/lib/capybara.rb:285:in `each'
            # /home/ubuntu/bundle/ruby/2.2.0/gems/capybara-2.6.2/lib/capybara.rb:285:in `reset_sessions!'
            # /home/ubuntu/bundle/ruby/2.2.0/gems/capybara-2.6.2/lib/capybara/rspec.rb:20:in `block (2 levels) in <top (required)>'

Finished in 2 minutes 18.7 seconds (files took 11.59 seconds to load)
672 examples, 69 failures, 10 pending

If we try to check the version or where phantomjs is located, we get following error:

ubuntu@ubuntu-xenial:/vagrant$ phantomjs --version
QXcbConnection: Could not connect to display
PhantomJS has crashed. Please read the bug reporting guide at
<http://phantomjs.org/bug-reporting.html> and file a bug report.
Aborted (core dumped)

Re-installing phantomjs and phantomjs-prebuilt as mentioned in our README.md it causes a lot of errors as well, e.g.

ubuntu@ubuntu-xenial:/vagrant$ sudo npm install -g phantomjs-prebuilt
/usr/local/bin/phantomjs -> /usr/local/lib/node_modules/phantomjs-prebuilt/bin/phantomjs

> phantomjs-prebuilt@2.1.14 install /usr/local/lib/node_modules/phantomjs-prebuilt
> node install.js

Considering PhantomJS found at /usr/local/bin/phantomjs
Looks like an `npm install -g`
Could not link global install, skipping...
Downloading https://github.com/Medium/phantomjs/releases/download/v2.1.1/phantomjs-2.1.1-linux-x86_64.tar.bz2
Saving to /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2
Receiving...
  [=======================================-] 97%
Received 22866K total.
Extracting tar contents (via spawned process)
Removing /usr/local/lib/node_modules/phantomjs-prebuilt/lib/phantom
Copying extracted folder /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1500473450699/phantomjs-2.1.1-linux-x86_64 -> /usr/local/lib/node_modules/phantomjs-prebuilt/lib/phantom
Phantom installation failed { [Error: EACCES: permission denied, link '/tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1500473450699/phantomjs-2.1.1-linux-x86_64' -> '/usr/local/lib/node_modules/phantomjs-prebuilt/lib/phantom']
  errno: -13,
  code: 'EACCES',
  syscall: 'link',
  path: '/tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1500473450699/phantomjs-2.1.1-linux-x86_64',
  dest: '/usr/local/lib/node_modules/phantomjs-prebuilt/lib/phantom' } Error: EACCES: permission denied, link '/tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1500473450699/phantomjs-2.1.1-linux-x86_64' -> '/usr/local/lib/node_modules/phantomjs-prebuilt/lib/phantom'
    at Error (native)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! phantomjs-prebuilt@2.1.14 install: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the phantomjs-prebuilt@2.1.14 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ubuntu/.npm/_logs/2017-07-19T14_10_55_609Z-debug.log

The phantomjs issue happened to @justahero and me. We fixed this by following these instructions.

We might need to update the README.md at a later time, wanted to document it first.

@1000miles 1000miles added the bug label Jul 19, 2017
@1000miles 1000miles changed the title PhantomJS Bug: QXcbConnection: Could not connect to display PhantomJS Error: 'QXcbConnection: Could not connect to display' Jul 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant