更新到MacOS Sierra时出现Cliver和PhantomJS错误

Ant*_* To 3 macos rspec ruby-on-rails phantomjs

我从OSX El Capitan更新到MacOS Sierra并开始看到PhantomJS错误.

$ rspec <some feature test
... The detector #<struct Cliver::Detector command_arg=nil, version_pattern=nil> failed to detect theversion of the executable at '/app/node_modules/phantomjs-prebuilt/bin/phantomjs'

我该如何解决这个问题?

Ant*_* To 11

经过一番游戏,我意识到$ phantomjs --version没有回头.奇怪.我也检查了两个

$ brew list
$ npm ls
Run Code Online (Sandbox Code Playgroud)

并且看到他们都没有将phantomjs列为他们的一个包裹.看起来我的phantomjs安装有问题.我决定全新安装phantomjs.

我首先确定了phantomjs的安装位置:

$ which phantomjs
/usr/local/bin/phantomjs
Run Code Online (Sandbox Code Playgroud)

去掉它:

$ rm -rf /usr/local/bin/phantomjs
$ phantomjs -v
-bash: /usr/local/bin/phantomjs: No such file or directory
Run Code Online (Sandbox Code Playgroud)

好.现在用npm安装phantomjs:

$ npm -g install phantomjs-prebuilt
$ phantomjs -v
2.1.1
Run Code Online (Sandbox Code Playgroud)

这很有希望.让我们再次运行我们的规范:

$ rspec <some feature test>
1 example, 0 failures
Run Code Online (Sandbox Code Playgroud)

成功.