Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do I have to add execjs and therubyracer to my gemfile for rails3.1 to work?

I don't like being in situations where I don't understand why something is working. I feel like I am using a trash bag and a rubber-band to fix a leaky pipe. Since upgrading to rails3.1 I have not been able to get it to work unless I add 'execjs' and 'therubyracer' to the gemfile. I do not understand what these gems even do. I just read somewhere on stackoverflow that you had to add them for the app to work. Anyone know what these gems are for?

like image 529
Spencer Cooley Avatar asked Nov 28 '22 10:11

Spencer Cooley


2 Answers

ExecJs - gives you the ability to, well - execute Javascript

RubyRacer - gives you the interface from Ruby to V8 engine.

Both are dependencies of the coffee-script gem, which is used by Rails 3.1 and the asset pipeline.

like image 177
lukaszkorecki Avatar answered Apr 27 '23 11:04

lukaszkorecki


ExecJS supports these runtimes:

therubyracer - Google V8 embedded within Ruby

therubyrhino - Mozilla Rhino embedded within JRuby

Node.js

Apple JavaScriptCore - Included with Mac OS X

Microsoft Windows Script Host (JScript)


therubyracer is not necessary, you can use any of the js runtimes instead, for example I use Node.js.

like image 39
Keating Avatar answered Apr 27 '23 09:04

Keating