ruby on rails起動時のエラー

$ rails s

をすると

/usr/local/lib/ruby/gems/1.9.1/gems/execjs-1.4.0/lib/execjs/runtimes.rb:51:in `autodetect': Could not find a JavaScript runtime. 
See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
from /usr/local/lib/ruby/gems/1.9.1/gems/execjs-1.4.0/lib/execjs.rb:5:in `<module:ExecJS>'

こんなエラーが発生。

$ gem install therubyracer

した後、
Gemfileに

gem 'therubyracer'

と定義すると解決した