0

After freshly installation of Ubuntu, Ruby 1.9.3 and Rails 3.2.19, am unable to start the rails server, I get this error:

  /var/lib/gems/1.9.1/gems/execjs-2.2.1/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 /var/lib/gems/1.9.1/gems/execjs-2.2.2/lib/execjs.rb:5:in `<module:ExecJS>'
from /var/lib/gems/1.9.1/gems/execjs-2.2.2/lib/execjs.rb:4:in `<top (required)>'
from /var/lib/gems/1.9.1/gems/coffee-script-2.3.0/lib/coffee_script.rb:1:in `require'

My environment details:
OS: Ubuntu 12.04 LTS
Ruby: 1.9.3-p551
Rails: 3.2.19
Browser: firefox 33.0

Cœur
  • 37,241
  • 25
  • 195
  • 267
Rasool
  • 173
  • 2
  • 10

1 Answers1

1

Read the Rails guide Starting up the Web Server :-

Compiling CoffeeScript and JavaScript asset compression requires you have a JavaScript runtime available on your system, in the absence of a runtime you will see an execjs error during asset compilation. Usually Mac OS X and Windows come with a JavaScript runtime installed. Rails adds the therubyracer gem to the generated Gemfile in a commented line for new apps and you can uncomment if you need it. therubyrhino is the recommended runtime for JRuby users and is added by default to the Gemfile in apps generated under JRuby. You can investigate all the supported runtimes at ExecJS or nodejs as written in this answer.

Community
  • 1
  • 1
Arup Rakshit
  • 116,827
  • 30
  • 260
  • 317
  • Thank you so much for your kind reply @Arup Rakshit, by installing the NodeJS solved my issue and definitely I will investigate this issue as per your suggesting with ExecJS, Thank you once again! – Rasool Nov 15 '14 at 17:33