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.
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.
You should prefer NodeJS over therubyracer
because NodeJS is memory efficient, but it might not be as easy to install, although on Mac OS it's easy so it is on Ubuntu.
On a *NIX system, you can just uncomment the gem "therubyracer"
in the gemfile and you're good to go, this is the easiest.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With