Poltergeistを使ったFeatureSpecで、phantomjsが無いと怒られるようになった時の対策

Poltergeistを使ったFeatureSpecで、phantomjsが無いと怒られるようになった

phantomjs -v
rbenv: phantomjs: command not found

The `phantomjs' command exists in these Ruby versions:
  2.5.5

何かのきっかけで、rbenv/shims配下にphantomjsが追加されたのかな?(調べられていない)

これを消して、暫定的に回避できた

mv ~/.rbenv/shims/phantomjs ~/.rbenv/shims/phantomjs.bak

一旦これで回避した(が、あとでちゃんと調べたい)

2019/4/26 追記

webdriversの2系のバージョンをインストールした際に、 rbenv/shims配下にphantomjsが作られていた模様。

$ gem list webdrivers

*** LOCAL GEMS ***

webdrivers (3.7.2, 2.4.0)

$ gem uninstall webdrivers

Select gem to uninstall:
1. webdrivers-2.4.0
2. webdrivers-3.7.2
3. All versions
> 1
Remove executables:
 IEDriverServer, MicrosoftWebDriver, chromedriver, geckodriver, phantomjs

in addition to the gem? [Yn]  Y

webdriversを削除したものの、shimsにはまだ残ってた。

$ which phantomjs
/Users/yoshito/.rbenv/shims/phantomjs

なので手動で削除

$ rm /Users/yoshito/.rbenv/shims/phantomjs

これで解決、無事に/usr/local/bin配下のphantomjsが参照されるようになった。

$ which phantomjs
/usr/local/bin/phantomjs