-4

I installed ruby 2.1.0 and rails 4.0.4. I created an application. When I started 'rails server', I got following errors:

/home/chandra/.rvm/gems/ruby-2.1.0/gems/execjs-2.0.2/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/chandra/.rvm/gems/ruby-2.1.0/gems/execjs-2.0.2/lib/execjs.rb:5:in `<module:ExecJS>'
from /home/chandra/.rvm/gems/ruby-2.1.0/gems/execjs-2.0.2/lib/execjs.rb:4:in `<top (required)>'
from /home/chandra/.rvm/gems/ruby-2.1.0/gems/uglifier-2.5.0/lib/uglifier.rb:3:in `require'
from /home/chandra/.rvm/gems/ruby-2.1.0/gems/uglifier-2.5.0/lib/uglifier.rb:3:in `<top (required)>'
from /home/chandra/.rvm/gems/ruby-2.1.0@global/gems/bundler-1.6.1/lib/bundler/runtime.rb:76:in `require'
from /home/chandra/.rvm/gems/ruby-2.1.0@global/gems/bundler-1.6.1/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from /home/chandra/.rvm/gems/ruby-2.1.0@global/gems/bundler-1.6.1/lib/bundler/runtime.rb:72:in `each'
from /home/chandra/.rvm/gems/ruby-2.1.0@global/gems/bundler-1.6.1/lib/bundler/runtime.rb:72:in `block in require'
from /home/chandra/.rvm/gems/ruby-2.1.0@global/gems/bundler-1.6.1/lib/bundler/runtime.rb:61:in `each'
from /home/chandra/.rvm/gems/ruby-2.1.0@global/gems/bundler-1.6.1/lib/bundler/runtime.rb:61:in `require'
from /home/chandra/.rvm/gems/ruby-2.1.0@global/gems/bundler-1.6.1/lib/bundler.rb:132:in `require'
from /home/chandra/Desktop/webApplication/assignment1/blog/config/application.rb:7:in `<top (required)>'
from /home/chandra/.rvm/gems/ruby-2.1.0/gems/railties-4.0.4/lib/rails/commands.rb:74:in `require'
from /home/chandra/.rvm/gems/ruby-2.1.0/gems/railties-4.0.4/lib/rails/commands.rb:74:in `block in <top (required)>'
from /home/chandra/.rvm/gems/ruby-2.1.0/gems/railties-4.0.4/lib/rails/commands.rb:71:in `tap'
from /home/chandra/.rvm/gems/ruby-2.1.0/gems/railties-4.0.4/lib/rails/commands.rb:71:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'

Any suggestion? Thanks.

Boris Stitnicky
  • 12,444
  • 5
  • 57
  • 74
manojg
  • 59
  • 8
  • possible duplicate of [ExecJS and could not find a JavaScript runtime](http://stackoverflow.com/questions/6282307/execjs-and-could-not-find-a-javascript-runtime) – Uelb Apr 05 '14 at 02:48

3 Answers3

1

As the first line says: You need to install a JavaScript runtime library. And you will find further information at the given url: https://github.com/sstephenson/execjs

spickermann
  • 100,941
  • 9
  • 101
  • 131
1

Install a javascript runtime like node js

if you are using ubuntu then follow the steps to get it install

sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs 
Monideep
  • 2,790
  • 18
  • 19
1

Have you tried to put gem 'therubyracer' in your gemfile?

Gil Gomes
  • 86
  • 1
  • 5