I am following the ruby on rails getting started guide on a new install of Ubuntu 12.10. I'm up to running rake db:create
but I get the following error:
rake aborted! Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes.
I've searched around and the suggested solutions (see list below) are to install some either therubyracer or nodejs but they don't explain why.
- rake db:create - Could not find a JavaScript runtime
- Rails 3.1 error - Could not find a JavaScript runtime?
- http://datacodescotch.blogspot.com.au/2011/11/rails-31-spree-and-rake-aborted-could.html
- http://www.blog.railshouse.com/
Before I go installing stuff I want to know what the differences are between these JavaScript runtimes and why I would choose one over the other?
Update:
I just read https://github.com/sstephenson/execjs (I know I should have read this first, sorry) and it seems to me that execjs is not a JavaScript runtime and I already have it... so it's down to therubyracer and nodejs ... please excuse my ignorance, I've amended my question
In addition to Intrepidd's answer:
The ruby on rails getting started guide supports Intrepidd's answer. See section 4.1 "Starting up the Web Server" where it says:
Rails adds the therubyracer gem to Gemfile in a commented line for new apps and you can uncomment if you need it.
For the rails noobs out there (like me) the GemFile is in the root folder of your rails application. After uncommenting that line in my GemFile I had to run bundle install
to install therubyracer gem.