Repository navigation
Closed
Milestone
Description
Got error when trying to start WebBrick
/home/mojo/.rvm/gems/ree-1.8.7-2011.03@rails31/gems/execjs-0.3.2/lib/execjs.rb:32:in `runtime': Could not find a JavaScript runtime (ExecJS::RuntimeError)
from /home/mojo/.rvm/gems/ree-1.8.7-2011.03@rails31/gems/execjs-0.3.2/lib/execjs.rb:44
from /home/mojo/.rvm/gems/ree-1.8.7-2011.03@rails31/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `require'
from /home/mojo/.rvm/gems/ree-1.8.7-2011.03@rails31/gems/coffee-script-2.2.0/lib/coffee_script.rb:1
from /home/mojo/.rvm/gems/ree-1.8.7-2011.03@rails31/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `require'
from /home/mojo/.rvm/gems/ree-1.8.7-2011.03@rails31/gems/coffee-script-2.2.0/lib/coffee-script.rb:1
from /home/mojo/.rvm/gems/ree-1.8.7-2011.03@rails31/gems/actionpack-3.1.0.beta1/lib/sprockets/railtie.rb:4:in `require'
from /home/mojo/.rvm/gems/ree-1.8.7-2011.03@rails31/gems/actionpack-3.1.0.beta1/lib/sprockets/railtie.rb:4:in `using_coffee?'
from /home/mojo/.rvm/gems/ree-1.8.7-2011.03@rails31/gems/actionpack-3.1.0.beta1/lib/sprockets/railtie.rb:17
from /home/mojo/.rvm/gems/ree-1.8.7-2011.03@rails31/gems/actionpack-3.1.0.beta1/lib/action_controller/railtie.rb:7:in `require'
from /home/mojo/.rvm/gems/ree-1.8.7-2011.03@rails31/gems/actionpack-3.1.0.beta1/lib/action_controller/railtie.rb:7
from /home/mojo/.rvm/gems/ree-1.8.7-2011.03@rails31/gems/activerecord-3.1.0.beta1/lib/active_record/railtie.rb:9:in `require'
from /home/mojo/.rvm/gems/ree-1.8.7-2011.03@rails31/gems/activerecord-3.1.0.beta1/lib/active_record/railtie.rb:9
from /home/mojo/.rvm/gems/ree-1.8.7-2011.03@rails31/gems/railties-3.1.0.beta1/lib/rails/all.rb:11:in `require'
from /home/mojo/.rvm/gems/ree-1.8.7-2011.03@rails31/gems/railties-3.1.0.beta1/lib/rails/all.rb:11
from /home/mojo/.rvm/gems/ree-1.8.7-2011.03@rails31/gems/railties-3.1.0.beta1/lib/rails/all.rb:5:in `each'
from /home/mojo/.rvm/gems/ree-1.8.7-2011.03@rails31/gems/railties-3.1.0.beta1/lib/rails/all.rb:5
from /home/mojo/Sites/hello/config/application.rb:3:in `require'
from /home/mojo/Sites/hello/config/application.rb:3
from /home/mojo/.rvm/gems/ree-1.8.7-2011.03@rails31/gems/railties-3.1.0.beta1/lib/rails/commands.rb:51:in `require'
from /home/mojo/.rvm/gems/ree-1.8.7-2011.03@rails31/gems/railties-3.1.0.beta1/lib/rails/commands.rb:51
from /home/mojo/.rvm/gems/ree-1.8.7-2011.03@rails31/gems/railties-3.1.0.beta1/lib/rails/commands.rb:48:in `tap'
from /home/mojo/.rvm/gems/ree-1.8.7-2011.03@rails31/gems/railties-3.1.0.beta1/lib/rails/commands.rb:48
from script/rails:6:in `require'
from script/rails:6
Activity
josevalim commentedon May 6, 2011
@JONESLEE85, you need an ExecJS runtime, one of the several listed here: https://github.com/sstephenson/execjs
@josh I have seen this question also coming up on twitter. Can we change execjs message again? Maybe we could say something like: "Could not find a JavaScript runtime. Please install one of the following: [list of available runtimes]. You can read more about it here: [link to execjs project]."
runlevel5 commentedon May 7, 2011
I re-open this issue because I still get the same error ONLY on my Linux box even though execjs 0.3.2 and 0.3.3 is there. Steps to re-produce:
EDIT: Works with OSX. Got problem with Ubuntu 11.04 (2.6.38-8-generic) + ree-1.8.7-2011.03 [ i386 ]
josevalim commentedon May 7, 2011
Yes, you need to install one of the runtimes I linked above. Meanwhile we will improve the ExecJS message, please don't close the ticket.
josh commentedon May 7, 2011
sstephenson/execjs@ee65ab1
josevalim commentedon May 7, 2011
Sweet, thanks @josh.
demonchand commentedon May 17, 2011
Hi guys i also got the same problem, but i added "therubyracer" on Gemfile it works fine. My question is keep adding like this for all new projects?
ramgole commentedon Sep 1, 2011
I am following the steps in Rails Guide 3.1.
I had to add gem 'therubyracer' to avoid errors.
Again is this how we have to do for any new rails project?
samirafk commentedon Sep 23, 2011
follow the below command so that you don't need to run( gem 'therubyracer' & bundle install ) for every new project
ramgole commentedon Sep 24, 2011
I think adding the gem is much simpler
samirafk commentedon Sep 24, 2011
no that is very simple & dont need to set gem 'therubyracer' & bundle install for any new project
i write it again in simple way:
wget http://nodejs.org/dist/node-v0.4.8.tar.gz
gunzip node-v0.4.8.tar.gz
tar -xf node-v0.4.8.tar
cd node-v0.4.8
./configure
make
make install
jrochkind commentedon Sep 29, 2011
I don't understand why the Rails 3.1 new project generator doesn't just include a gem in your Gemfile with a javscript runtime -- since by default it's including gems that require a javascript runtime. I don't understand the rationale of having the default app generator produce an app that you can't actually run, not even to get the 'hello world' message.
What am i missing? At the very least, some documentation should be provided in a prominent place (the 'getting started' Guide?) explaining whatever it is I'm missing; the present situation is very confusing for people getting started.
guilleiguaran commentedon Sep 29, 2011
@jrochkind the new project generator doesn't include a javascript runtime by default because no all the users need a gem for it: Mac OS X include a JavascriptCore runtime by default, Windows include Windows Script Host by default and some others users have Node.js installed.
demonchand commentedon Oct 10, 2011
This link is help you to install the node.js
https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager
pjmelling commentedon Oct 12, 2011
I had this problem, too. I run Linux and didn't have node.js installed before I read this thread. Once installed, my Rails 3.1 app ran without the ExecJS error.
If you're running Ubuntu 10.10 as I am, running 'sudo aptitude install nodejs' will install node.js. It provided the javascript runtime that execjs could use in my Rails 3.1 app and I didn't need to do anything to tell ExecJS how to find it.
I think your answer, @guilleiguaran is right on. I think it's good that the generator doesn't provide a javascript runtime. At least for now. At the same time, the tutorials would be more helpful by providing a note about this dependency and link or two pointing to more information. So I agree with you, @jrochkind, it's confusing at first.
renatosousafilho commentedon Oct 31, 2011
Oh Great, pjmelling, you are ready, Thanks for Collaboration.
brentsowers1 commentedon Jan 11, 2012
I echo jrochkind's comment. It's a little ridiculous that you can't run a freshly generated Rails app in Linux unless node.js is installed. Is there a reason why the rails new generator doesn't add therubyracer (or therubyrhino for JRuby) to the Gemfile, if there is no Javascript runtime on the system? I think I will issue a fix for this and issue a pull request.
guilleiguaran commentedon Jan 11, 2012
@brentsowers1 we discussed it in #3619.
in the next versions of Rails (starting with 3.1.x) therubyrhino will be included by default on Gemfile if JRuby is detected.
jrochkind commentedon Jan 11, 2012
@brentsowers1 I was trying to think through methods in which the rails
installer could determine if a JS runtime was available at generation
time, to add the Gemfile dependency if it's not. I can't think of any
way but FIRST installing the execjs gem (if it's not installed?) and
use it's API to determine if there's an available runtime (which
probably means there needs to be a version dependency on execjs since
it's using it's API). Maybe first install the Gemfile as it now (which
includes an execjs indirect dependency), then 'bundle install', THEN
(after Bundler.setup to get that dependency) use the execjs API, and
if neccesary (and it's MRI) THEN add therubyracer dependency. But
'bundle install' in 'Bunder.setup' are so sadly slow (especially when
run via subshell, isn't there bundler api to do that instead? and
especially under 1.9.x, even 1.9.3), that doing extra ones like this
is a drag. So I'm not sure.
I had only thought a bit, not started coding. I encourage you to try
to figure it out and pull request, and hope the committers would
accept such a thing. It definitely seems to me that 'rails new' ought
to give you a runnable app on linux, which it does not currently.
On Jan 10, 2012, at 10:34 PM, Guillermo Iguaran wrote:
brentsowers1 commentedon Jan 11, 2012
I'm working on a fix now, I just looked at the way execjs does it and copied that approach. I'm testing my fix on Windows now (Windows doesn't need a gem added), once I verify that I'll issue a pull request.
brentsowers1 commentedon Jan 11, 2012
I've fixed this now, running rails new on a Linux system that does not have node.js will add therubyracer to the Gemfile. I've created 3 pull requests:
For Rails 3.1 - #4407
For Rails 3.2 - #4406
For Rails master - #4405
Merge pull request #412 from yui-knk/remove_not_used_codes