I run rails new project on Ubuntu 11.04, and I get the following when I try to run rails server:
rails new project
However, it's fixed by added gem 'therubyracer' to my Gemfile, and running bundle install again.
Why isn't it in the default Gemfile?
Because it's only one of the runtimes and it only works when you can compile c extensions (i.e. not Windows or jruby).
Also prevents usage of external runtimes.
The preferred runtime for Ubuntu is node. sudo apt-get install nodejs.
sudo apt-get install nodejs
I see. Well, in that case, can I suggest that a message in the Gemfile say something like "You need to add a JS runtime - Mac users are fine, Windows is fine, Linux and jRuby folks need to install something from here https://github.com/sstephenson/execjs"?
Reason I say in the actual Gemfile is because I (and most other devs I know) read their Gemfile to make sure things are A-OK.
Let me add a +1 for making it "Just Work". 3.0.9 "Just Works" when you run rails server ... I know you guys don't want to force us to use a particular JS run-time, but to get to step 3 (from 'Make your application' on rubyonrails.org) and throw an error is just plain inelegant. Besides, I thought it was an opinionated framework?
Why not just require Node.js and include in the documentation how to switch to one of the other alternatives? Or, just document it so that we know we have to download one. I spent 30 minutes tracking this down and still managed to not pick the preferred JS run-time. It would also be helpful if execjs would provide a preferred list as Samuel did above, so that the neo-newbs (getting back into Rails after a hiatus) might be able to buy a vowel. But I digress.
It would be really nice if this requirements were removed from the base Gemfile. It's a PITA for new users who try Rails now to figure this stuff out. People should be required to select SCSS and a JS runtime instead of being forced and not being able to run Rails at all for the first time.
I'm working in a solution for this, I will add therubyracer/therubyrhino under Linux/*BSD/etc when Node.js isn't present
Add therubyracer/therubyrhino to Gemfile when there isn't a JS Runtim…
…e available in the system. Closes #2963
There isn't a clean way to do this automatically, the best option for now will be update the docs to reflect this.
tar xfv node-v0.1.31.tar.gz
This the current status of this:
I'm closing this issue for now.