4

I just upgraded from Rails 3.2.10 to 3.2.11 and have made no other changes on my application.

All of a sudden, my site won't load - and gives me the error message:

ExecJS::RuntimeError in Static_pages#home

Is anyone aware of why the changes in Rails 3.2.11 would be causing this problem?

ExecJS::RuntimeError in Static_pages#home

Showing C:/Sites/av_reports/app/views/layouts/application.html.erb where line #11 raised:


  (in C:/Sites/av_reports/app/assets/javascripts/password_resets.js.coffee)
Extracted source (around line #11):

8:  <meta name="author" content="">
9:  
10:     <%= stylesheet_link_tag    "application", :media => "all" %>
11:     <%= javascript_include_tag "application" %>
12:     <%= csrf_meta_tags %>
13:     <%= render 'layouts/shim' %>
14:   </head>

My /app/assets/javascripts/password_resets.js.coffee file contains 3 lines of commented-out text, so I'm guessing that's not the problem.

Is there a change in gem dependency or something like that - which could be causing the problem?

Edit

My application.js file reads:

// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
// GO AFTER THE REQUIRES BELOW.
//
//= require jquery
//= require jquery_ujs
//= require bootstrap
//= require_tree .
2scottish
  • 673
  • 3
  • 10
  • 21

2 Answers2

4

So... apparently this wasn't a Rails 3.2.11 upgrade issue at all. The underlying issue was the way that ExecJS works within Windows. I am currently running my development environment on Windows 8.

Before upgrading to Rails 3.2.11, the above error message would show up in the server log, but it didn't halt the server. In Rails 3.2.11, the page would no longer load.

The solution was to edit the Ruby1.9.3\lib\ruby\gems\1.9.1\gems\execjs-1.4.0\lib\execjs\runtimes.rb file:

(original non-working code):

JScript = ExternalRuntime.new(
    :name        => "JScript",
    :command     => "cscript //E:jscript //Nologo //U",
    :runner_path => ExecJS.root + "/support/jscript_runner.js",
    :encoding    => 'UTF-16LE' # CScript with //U returns UTF-16LE
)

(updated working code):

JScript = ExternalRuntime.new(
    :name        => "JScript",
    :command     => "cscript //E:jscript //Nologo",
    :runner_path => ExecJS.root + "/support/jscript_runner.js",
    :encoding    => 'UTF-8' # CScript with //U returns UTF-16LE
)

My thanks to the comment thread at: https://github.com/sstephenson/execjs/issues/81#issuecomment-9892952

and the discussion at: https://stackoverflow.com/a/14119187/1757424 for help with this issue.

Community
  • 1
  • 1
2scottish
  • 673
  • 3
  • 10
  • 21
0

I have some problem, but i was use Ruby2.0.0

the solution is edit the Ruby2.0.0\lib\ruby\gems\2.0.0\gems\execjs-2.2.1\lib\execjs\runtimes.rb

Ari Pratomo
  • 1,195
  • 12
  • 8