My schedule right now is not very tight and I have a couple of hours free almost everyday. So instead of playing Skyrim, I am learning Ruby on Rails.
I am using RVM (http://beginrescueend.com/) on Ubuntu Ubuntu 10.04 LTS (Lucid Lynx).
Here is the error I get when I try to run “rails server”:
wenbert@ubuntu:~/projects/rails/depot$ rails server /home/wenbert/.rvm/gems/ruby-1.9.2-p290/gems/execjs-1.2.12/lib/execjs/runtimes.rb:47:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable) from /home/wenbert/.rvm/gems/ruby-1.9.2-p290/gems/execjs-1.2.12/lib/execjs.rb:5:in `<module:ExecJS>' from /home/wenbert/.rvm/gems/ruby-1.9.2-p290/gems/execjs-1.2.12/lib/execjs.rb:4:in `<top (required)>' from /home/wenbert/.rvm/gems/ruby-1.9.2-p290/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `require' from /home/wenbert/.rvm/gems/ruby-1.9.2-p290/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `<top (required)>' from /home/wenbert/.rvm/gems/ruby-1.9.2-p290/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `require' from /home/wenbert/.rvm/gems/ruby-1.9.2-p290/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `<top (required)>' from /home/wenbert/.rvm/gems/ruby-1.9.2-p290/gems/coffee-rails-3.1.1/lib/coffee-rails.rb:1:in `require' from /home/wenber |
A lot of people have already experienced this error. There is a popular thread for this in Stackoverflow – here. The Original Poster of the thread selected the this answer:
I’m on Ubuntu 11.04. Had similar issues. Installing node.js fixed this for me
https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager
But I think the more appropriate answer is the one by vincent jacquel in this thread.
The Fix
- Open the
Gemfile
- Add these lines:
gem 'execjs' gem 'therubyracer'
- Save.
- Then run this command:
$> bundle after
Hi,
I also encountered that. so yeah, that is a very common issue. RoR integrated coffeescript in 3.1
Install JavaScript runtime environment in your systems by using following steps. this is best way to sole
wget http://nodejs.org/dist/node-v0.1.31.tar.gz
tar xfv node-v0.1.31.tar.gz
cd node-v0.1.31
./configure
make
make install
Thanks,
Jagat Singh
Thanks for the fix. Ruby on Rails is awesome but has a couple tricks you need to know.
@jagat, that would also solve the problem but IMHO it is not the best way…