rails 3.1.0 getting a javascript error?

I updated to the rails 3.1.0 from 3.0.9 and I am getting the following error, how can I fix?

yadav@karma:$ rails g scaffold post title:string name:string message:text /usr/local/lib/ruby/gems/1.9.1/gems/execjs-1.2.4/lib/execjs/runtimes.rb:45: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.2.4/lib/execjs.rb:5:in `<module:ExecJS>'         from /usr/local/lib/ruby/gems/1.9.1/gems/execjs-1.2.4/lib/execjs.rb:4:in `<top (required)>'         from /usr/local/lib/ruby/gems/1.9.1/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `require'         from /usr/local/lib/ruby/gems/1.9.1/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `<top (required)>'         from /usr/local/lib/ruby/gems/1.9.1/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `require'

My rails environment & gems listed below

$ rails -v Rails 3.1.0

$ ruby -v ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]

$ gem -v 1.8.10

*** LOCAL GEMS ***

abstract (1.0.0) actionmailer (3.1.0, 3.0.9) actionpack (3.1.0, 3.0.9) activemodel (3.1.0, 3.0.9) activerecord (3.1.0, 3.0.9) activeresource (3.1.0, 3.0.9) activesupport (3.1.0, 3.0.9) ansi (1.3.0) arel (2.2.1, 2.0.10) authlogic (3.0.3) autotest (4.4.6) autotest-rails-pure (4.1.2) babosa (0.3.5) bcrypt-ruby (3.0.0, 2.1.4) builder (3.0.0, 2.1.2) bundler (1.0.18, 1.0.15) calendar_date_select (1.16.3) cancan (1.6.5) coffee-rails (3.1.0) coffee-script (2.2.0) coffee-script-source (1.1.2) daemon_controller (0.2.6) devise (1.4.4, 1.4.2) diff-lcs (1.1.3, 1.1.2) erubis (2.7.0, 2.6.6) execjs (1.2.4) fastri (0.3.1.1) fastthread (1.0.7) file-tail (1.0.6) forgery (0.3.12) friendly_id (3.3.0.1, 3.2.1.1) grackle (0.1.10) gruff (0.3.6) hike (1.2.1) i18n (0.6.0, 0.5.0) jquery-rails (1.0.13) json (1.5.4, 1.5.3) mail (2.3.0, 2.2.19) mechanize (2.0.1) mime-types (1.16) minitest (2.5.1, 1.6.0) multi_json (1.0.3) net-http-digest_auth (1.1.1) net-http-persistent (2.0, 1.8) nifty-generators (0.4.6) nokogiri (1.5.0) oauth (0.4.5) orm_adapter (0.0.5) passenger (3.0.8, 3.0.7) patron (0.4.15, 0.4.13) pg (0.11.0) polyglot (0.3.2, 0.3.1) rack (1.3.2, 1.2.3) rack-cache (1.0.3) rack-mount (0.8.3, 0.6.14) rack-ssl (1.3.2) rack-test (0.6.1, 0.5.7) rails (3.1.0, 3.0.9) railties (3.1.0, 3.0.9) rake (0.9.2, 0.8.7) rdoc (3.9.4, 3.8, 2.5.8) RedCloth (4.2.8, 4.2.7) rmagick (2.13.1) rspec (2.6.0) rspec-core (2.6.4) rspec-expectations (2.6.0) rspec-mocks (2.6.0) rspec-rails (2.6.1) ruby-json (1.1.2) rubygems-update (1.8.10, 1.8.5) sass (3.1.7) sass-rails (3.1.0) sprockets (2.0.0) spruz (0.2.13, 0.2.11) sqlite3 (1.3.4) thor (0.14.6) tilt (1.3.3) tiny_mce (0.1.4) tkri (0.9.5) treetop (1.4.10, 1.4.9) turn (0.8.2) tzinfo (0.3.29) uglifier (1.0.2) w3c_validators (1.1.1) warden (1.0.5, 1.0.4) webrat (0.7.3) webrobots (0.0.11, 0.0.10) will_paginate (3.0.0, 2.3.15) wxruby (2.0.0 x86_64-linux) ZenTest (4.6.2, 4.6.0)

I installed coffee-script and ExecJS however I am seeing

$ rails generate scaffold Post name:string title:string content:text /usr/local/lib/ruby/gems/1.9.1/gems/execjs-1.2.4/lib/execjs/runtimes.rb:45: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.2.4/lib/execjs.rb:5:in `<module:ExecJS>'         from /usr/local/lib/ruby/gems/1.9.1/gems/execjs-1.2.4/lib/execjs.rb:4:in `<top (required)>'         from /usr/local/lib/ruby/gems/1.9.1/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `require'         from /usr/local/lib/ruby/gems/1.9.1/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `<top (required)>'         from /usr/local/lib/ruby/gems/1.9.1/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `require'         from /usr/local/lib/ruby/gems/1.9.1/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `<top (required)>'         from /usr/local/lib/ruby/gems/1.9.1/gems/coffee-rails-3.1.0/lib/coffee-rails.rb:1:in `require'         from /usr/local/lib/ruby/gems/1.9.1/gems/coffee-rails-3.1.0/lib/coffee-rails.rb:1:in `<top (required)>'         from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/runtime.rb:68:in `require'         from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/runtime.rb:68:in `block (2 levels) in require'         from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/runtime.rb:66:in `each'         from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/runtime.rb:66:in `block in require'         from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/runtime.rb:55:in `each'         from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/runtime.rb:55:in `require'         from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler.rb:120:in `require'         from /home/yadav/dev/rails/tmp/blog/config/application.rb:7:in `<top (required)>'         from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.1.0/lib/rails/commands.rb:21:in `require'         from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.1.0/lib/rails/commands.rb:21:in `<top (required)>'         from script/rails:6:in `require'         from script/rails:6:in `<main>'

try to add to Gemfile gem 'execjs' gem 'therubyracer'

and bundle update bundle install

Thanks that got things working!

Kind Regards, Rajinder Yasdav

/usr/local/lib/ruby/gems/1.9.1/gems/execjs-2.6.0/lib/execjs/runtimes.rb:48:in `autodetect': Could not find a JavaScript runtime. See GitHub - rails/execjs: Run JavaScript code from Ruby for a list of available runtimes. (ExecJS::RuntimeUnavailable)         from /usr/local/lib/ruby/gems/1.9.1/gems/execjs-2.6.0/lib/execjs.rb:5:in `<module:ExecJS>'         from /usr/local/lib/ruby/gems/1.9.1/gems/execjs-2.6.0/lib/execjs.rb:4:in `<top (required)>'         from /usr/local/lib/ruby/gems/1.9.1/gems/coffee-script-2.4.1/lib/coffee_script.rb:1:in `require'         from /usr/local/lib/ruby/gems/1.9.1/gems/coffee-script-2.4.1/lib/coffee_script.rb:1:in `<top (required)>'         from /usr/local/lib/ruby/gems/1.9.1/gems/coffee-script-2.4.1/lib/coffee-script.rb:1:in `require'         from /usr/local/lib/ruby/gems/1.9.1/gems/coffee-script-2.4.1/lib/coffee-script.rb:1:in `<top (required)>'         from /usr/local/lib/ruby/gems/1.9.1/gems/coffee-rails-3.2.2/lib/coffee-rails.rb:1:in `require'         from /usr/local/lib/ruby/gems/1.9.1/gems/coffee-rails-3.2.2/lib/coffee-rails.rb:1:in `<top (required)>'         from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `require'         from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `block (2 levels) in require'         from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `each'         from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `block in require'         from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `each'         from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `require'         from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.10.6/lib/bundler.rb:134:in `require'         from /users/home101/hmurthy/projects/projects/config/application.rb:7:in `<top (required)>'         from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.21/lib/rails/commands.rb:53:in `require'         from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.21/lib/rails/commands.rb:53:in `block in <top (required)>'         from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.21/lib/rails/commands.rb:50:in `tap'         from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.21/lib/rails/commands.rb:50:in `<top (required)>'         from script/rails:6:in `require'         from script/rails:6:in `<main>'

Hi,

i even installed execjs and therubyracer, after that did bundle update and install still im seeing this issue please do let me know what should i do further???

Regards, Harshita

Which version of ruby are you using? Use ruby -v to find out.

Post your Gemfile.lock here please.

Colin