幻影给版本不匹配

时间:2016-06-06 08:57:14

标签: ruby phantomjs cucumber

使用

  • Ubuntu 16.04
  • Ruby 2.0.0
  • (宝石)黄瓜(1.3.20)
  • (gem)cucumber-rails(1.4.2)

最初我有

Could not find an executable ["phantomjs"] on your path. (Cliver::Dependency::NotFound)

使用https://stackoverflow.com/a/31333531/849697修正了

然后

Could not find an executable 'phantomjs' that matched the requirements '>= 1.8.1', '< 3.0'. Found versions were {"/usr/bin/phantomjs"=>"127.0.0.1"}. (Cliver::Dependency::VersionMismatch)

奇怪的是,似乎给出了应该是版本的IP地址。

phantomjsphantomjs --version都提供了

QXcbConnection: Could not connect to display 127.0.0.1:10.0
PhantomJS has crashed. Please read the bug reporting guide at
<http://phantomjs.org/bug-reporting.html> and file a bug report.
[1]    1919 abort (core dumped)  phantomjs --version

(前者没有--version

1 个答案:

答案 0 :(得分:0)

通过从bitbucket下载后直接安装phantomjs,phantomjs --version正常工作,测试正在运行并按预期传递。

https://bitbucket.org/ariya/phantomjs/downloads - &gt;下载,解压缩phantomjs可执行文件,sudo mv它覆盖/usr/bin/phantomjs

安装的sudo apt-get install phantomjs

编辑之前我正在做这个解决方法:

xvfb-run --auto-servernum bundle exec cucumber

xvfb是一个显示服务器,用于安装sudo apt-get install xvfb