令狐葱
令狐葱

Reputation: 1127

cannot connect to X server with phantomjs, why?

When I use phantomjs on ubuntu 12.0, the following error occurs:

phantomjs: cannot connect to X server

After Googling, I tried:

root@AY14021815431085179aZ:~# xhost local:root

xhost: unable to open display ""

But it still doesn't work.

Upvotes: 1

Views: 3771

Answers (1)

jdar
jdar

Reputation: 312

The distribution-specific package may not always be on the latest stable version. If you don't want to install and use xvbf (for versions <=1.4 of phantomjs), or if you want a relatively recent version, with updated functionality, uninstall your instance of phantomjs and do the following:

  1. download a binary here: http://phantomjs.org/download.html

  2. unpack (e.g., tar -xvjpf *.bz2)

  3. make sure the binary is exported or otherwise in your $PATH

phantomjs -v

Try running the tests that depend on phantomjs, assuming phantomjs is already integrated into the test suite.

Upvotes: 5

Related Questions