Rails 3.1.rc1 + gem coffee-script - WEBrick and Unicorn hangs.

Environment: rvm ruby 1.9.2-p180 rails 3.1.rc1

Conditions: gem "coffee-script" # in Gemfile at least one file with .js.coffee (even empty inside) in app/assets

Result: WEBrick or Unicorn hangs. Only kill -9 <pid> helps.

P.S. What additional info should I provide?

Oh, I forgot! I think the problem is somewhere around these two lines in my Gemfile:

gem 'therubyracer', :require => 'v8' gem 'uglifier'

Because without the first line Rails gives me this on start: in `<module:ExecJS>': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)

You need a javascript interpreter like therubyracer installed. Keep that line, but remove the version. It shouldn’t be necessary. Try running your app with and without the uglifier gem. My guess is a problem with uglifier. If so, post the error from that.

now these two lines: gem 'therubyracer' gem 'uglifier'

When I remove gem 'uglifier' - nothning changes - server is still hangs on the first request. This is the last strings in log: Started GET "/assets/application.css" for 127.0.0.1 at 2011-05-28 09:36:36 +1000 Compiled app/assets/stylesheets/application.css (19ms) (pid 27815) Compiled app/assets/stylesheets/home.css.scss (45ms) (pid 27815) Compiled app/assets/stylesheets/news.css.scss (1ms) (pid 27815) Compiled app/assets/stylesheets/sections.css.scss (30ms) (pid 27815) Compiled app/assets/stylesheets/application.css (0ms) (pid 27815)

Served asset /application.css - 200 OK (0.101s) (pid 27815)

Started GET "/assets/application.js" for 127.0.0.1 at 2011-05-28 09:36:36 +1000 Compiled app/assets/javascripts/application.js (4ms) (pid 27815) Compiled ~/.rvm/gems/ruby-1.9.2-p180@cancer/gems/jquery-rails-1.0.9/vendor/assets/javascripts/jquery.js (35ms) (pid 27815) Compiled ~/.rvm/gems/ruby-1.9.2-p180@cancer/gems/jquery-rails-1.0.9/vendor/assets/javascripts/jquery-ui.js (1ms) (pid 27815) Compiled ~/.rvm/gems/ruby-1.9.2-p180@cancer/gems/jquery-rails-1.0.9/vendor/assets/javascripts/jquery_ujs.js (0ms) (pid 27815) Compiled app/assets/javascripts/home.js (0ms) (pid 27815) Compiled app/assets/javascripts/news.js (0ms) (pid 27815)

After news.js there is a file named sections.js.coffee and it's empty. Server always hangs before this file compiling with or without uglifier gem.

So there is no error actually being output from the server? It just straight up hangs?

Without any error output, or trace, it’s very hard to say. At this point I wouldn’t know what to point my finger at except for the local extensions of the js runtime. Maybe try replacing therubyracer with another gem like therubyrhino, run bundle update and see if you have any different, or at least more verbose results.

So:

in ./Gemfile

remove: gem ‘therubyracer’

insert: gem ‘therubyrhino’

then from the shell:

changed gem 'therubyracer' to gem 'therubyrhino' run bundle update

Got this:

in `<module:ExecJS>': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)

Hey,

I managed to reproduce your problem with therubyrhino not being recognized, and I went on to test the mustang engine, and that causes the ExecJS framework to crash outright. I believe this may be a problem more related to ExecJS, you will likely get some better help over on the ExecJS Issues board, here: https://github.com/sstephenson/execjs/issues

Good Luck!

Thanks for all the help and advices! New therubyracer 0.9.0 gem did the trick. Still don't know the reason of such behaviour.