Server is not starting

I am running the command rails server on ubuntu 12.04 having rails 3 but
getting following error.

amir@ubuntu:~/app$ rails server
/home/amir/.rvm/gems/ruby-1.9.2-p320/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
/home/amir/.rvm/gems/ruby-1.9.2-p320/gems/execjs-1.4.0/lib/execjs.rb:5:in
`<module:ExecJS>'
  from
/home/amir/.rvm/gems/ruby-1.9.2-p320/gems/execjs-1.4.0/lib/execjs.rb:4:in
`<top (required)>'
  from
/home/amir/.rvm/gems/ruby-1.9.2-p320/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in
`require'
  from
/home/amir/.rvm/gems/ruby-1.9.2-p320/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in
`<top (required)>'
  from
/home/amir/.rvm/gems/ruby-1.9.2-p320/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in
`require'
  from
/home/amir/.rvm/gems/ruby-1.9.2-p320/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in
`<top (required)>'
  from
/home/amir/.rvm/gems/ruby-1.9.2-p320/gems/coffee-rails-3.2.2/lib/coffee-rails.rb:1:in
`require'
  from
/home/amir/.rvm/gems/ruby-1.9.2-p320/gems/coffee-rails-3.2.2/lib/coffee-rails.rb:1:in
`<top (required)>'
  from
/home/amir/.rvm/gems/ruby-1.9.2-p320/gems/bundler-1.1.4/lib/bundler/runtime.rb:68:in
`require'
  from
/home/amir/.rvm/gems/ruby-1.9.2-p320/gems/bundler-1.1.4/lib/bundler/runtime.rb:68:in
`block (2 levels) in require'
  from
/home/amir/.rvm/gems/ruby-1.9.2-p320/gems/bundler-1.1.4/lib/bundler/runtime.rb:66:in
`each'
  from
/home/amir/.rvm/gems/ruby-1.9.2-p320/gems/bundler-1.1.4/lib/bundler/runtime.rb:66:in
`block in require'
  from
/home/amir/.rvm/gems/ruby-1.9.2-p320/gems/bundler-1.1.4/lib/bundler/runtime.rb:55:in
`each'
  from
/home/amir/.rvm/gems/ruby-1.9.2-p320/gems/bundler-1.1.4/lib/bundler/runtime.rb:55:in
`require'
  from
/home/amir/.rvm/gems/ruby-1.9.2-p320/gems/bundler-1.1.4/lib/bundler.rb:119:in
`require'
  from /home/amir/app/config/application.rb:7:in `<top (required)>'
  from
/home/amir/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.6/lib/rails/commands.rb:53:in
`require'
  from
/home/amir/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.6/lib/rails/commands.rb:53:in
`block in <top (required)>'
  from
/home/amir/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.6/lib/rails/commands.rb:50:in
`tap'
  from
/home/amir/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.6/lib/rails/commands.rb:50:in
`<top (required)>'
  from script/rails:6:in `require'
  from script/rails:6:in `<main>'

Any help is appreciable.

Thanks
Amir

In your gem file add:

gem ‘ejxecjs’
gem ‘therubyracer’

save and run “bundle install”

Or you can install node.js on ubuntu:
http://qugstart.com/blog/node-js/how-to-install-node-js-on-ubuntu-and-create-an-app-in-5-minutes/

Matt’s

Sorry,

gem ‘execjs’

Matt’s

Check what the error message is telling you. You need to install a JavaScript runtime.

Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes

No offense but did you even read the error message before posting here?

You may install nodejs using
sudo apt-get install nodejs

This may solve the problem.

hard to believe rails sets up an app without this working...yikes.

Hard to believe that there are people that share their pure thoughts on a mailing list, without having any problem or value for discussion.