herokuコマンドが正常に動作しなくなったら
環境:MacOS 10.7.4
heroku appsを実行したら、新しいのが出てるからheroku updateで新しくしてね、というので新しくしたらheroku appsでエラーが出て何も出来ない!バグ!?とか思って数日。
ほかのコマンドを試してみても以下のようなエラーメッセージが。
$ heroku update /Users/sasaplus1/.heroku/client/lib/heroku/cli.rb:30:in `start': undefined method `styled_error' for Heroku::CLI:Class (NoMethodError) from /usr/bin/heroku:28
どうしたもんかなあと思い適当にコマンドを実行してたら気になる記述が。
$ heroku version heroku-toolbelt/2.30.3 (universal-darwin11.0) ruby/1.8.7
Ruby 1.8.7……?お、思い当たりが……
何に思い当たったかというと、rbenvでした。
rbenvで1.9.2を入れたので、もしかしたらそちらを見に行っているせいなのかなーと。
$ ruby -v ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.3.0] $ rbenv local --unset $ rbenv global system $ rbenv shell --unset $ which ruby /Users/sasaplus1/.rbenv/shims/ruby $ ruby -v ruby 1.8.7 (2011-12-28 patchlevel 357) [universal-darwin11.0]
でシステムのRubyに戻して実行してみると……
$ heroku update
Updating from 2.30.3... done, nothing to update
ちゃんと動作した!というわけでrbenvやrvmを使用している場合は気をつけましょう。