Javascript Runtime for Rails 3.1

18 views
Skip to first unread message

Rodney Degracia

unread,
Sep 20, 2011, 12:41:19 PM9/20/11
to Orlando Ruby Users Group Discussion

Just curious, but does someone know the inside story as to why Rails 3.1 needs a Javascript runtime ?


Rodney Degracia
rdeg...@gmail.com

http://www.elitefrontier.org


Jacob Swanner

unread,
Sep 20, 2011, 12:54:24 PM9/20/11
to orug-di...@googlegroups.com
Rodney,

Rails 3.1 does not *need* a JavaScript runtime, but one is included by default: it's used for the asset pipeline, since it supports compiling CoffeeScript into JavaScript.

If this is not something that you want, you can remove the "gem 'coffee-script'" line from your Gemfile.

- Jacob
--
You received this message because you are subscribed to the Google Groups "Orlando Ruby Users Group Discussion" group.
To post to this group, send email to orug-di...@googlegroups.com.
To unsubscribe from this group, send email to orug-discussi...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/orug-discussion?hl=en.

Jason Seifer

unread,
Sep 20, 2011, 1:21:09 PM9/20/11
to orug-di...@googlegroups.com
This is unpossible, see reference at http://doihavetousecoffeescriptinrails.com

Rodney Degracia

unread,
Sep 20, 2011, 1:38:11 PM9/20/11
to orug-di...@googlegroups.com
Jacob,

The reason why I was asking, is because I did something like:

rvm gemset create rails31
rvm gemset use rails31
gem install rake
gem install rails -v 3.1.0
rails new testapp
cd testapp
bundle install
rails server

and then I got the error message, "Could not find a JavaScript runtime. See
https://github.com/sstephenson/execjs for a list of available runtimes."

Since the installation was a default installation, the error message
suggests that Rails 3.1.0 needs a Javascript runtime. I was just wondering
if anyone knew the backstory as to why that appears to be the case.


Rodney

Jacob Swanner

unread,
Sep 20, 2011, 2:30:53 PM9/20/11
to orug-di...@googlegroups.com
Rodney,

I guess I should correct my previous statement a bit: it does not include a JavaScript runtime, but does include execjs (through the coffee-script gem) which can use a number of different JavaScript runtimes.  If you look at the README of execjs you will see the list of runtimes that it works with.

All I was trying to say before was that Rails 3.1 does not actually require a JavaScript runtime; but, the default Gemfile it creates includes the coffee-script gem, which does require a JavaScript runtime.  Rails 3.1 will run just fine without one.

The ability to write your front-end scripts in CoffeeScript is worth installing one of the supported runtime, IMHO.

- Jacob

Marshall Sontag

unread,
Sep 20, 2011, 4:57:27 PM9/20/11
to orug-di...@googlegroups.com
I heard Rails can't scale either. Can anyone confirm or deny?

Matt Aimonetti

unread,
Sep 20, 2011, 5:05:01 PM9/20/11
to orug-di...@googlegroups.com
Confirm

Sent from my iPhone
Reply all
Reply to author
Forward
0 new messages