sozialhelden / wheelmap-classic

:wheelchair: Legacy "classic" wheelmap.org (deprecated)
http://www.wheelmap.org
GNU Affero General Public License v3.0
46 stars 16 forks source link

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

Open 1000miles opened 7 years ago

1000miles commented 7 years ago

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.