Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails 3.2 ActionView::Template::Error javascript_include_tag

I have a perfectly working dev environment on a windows 7 laptop. Today, I got a new windows 8 laptop and trying to set up the dev environment on it. Installed rails etc and created new sample app and it worked fine. Then I cloned my app and tried. Getting the following error:

Completed 500 Internal Server Error in 2354ms

 ActionView::Template::Error ((in C:/....../appname/app/assets/javascripts/gmaps4rails/gmaps4rails.base.js.coffee)):
3: <head>
4:   <title><%=yield :title %></title>
5:   <%= stylesheet_link_tag    "application", :media => "all" %>
6:   <%= javascript_include_tag "application" %>
7:   <%= csrf_meta_tags %>
8:   <%= render 'layouts/shim' %>
9: </head>
app/views/layouts/application.html.erb:6:in `_app_views_layouts_application_html_erb__782381622_56858160'


Rendered C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.2.7/lib/action_dispa

I googled and searched SO for javascript_include_tag and reviewed many threads but can not figure out a solution.

Appreciate any help in resolving this issue.

environment info:

$rails -v
Rails 3.2.7

$ruby -v
ruby 1.9.3p327 (2012-11-10) [i386-mingw32]

edit: I just noticed this problem occurs when I have coffee script file even an empty one. I still don't know how to resolve it.

like image 869
korada Avatar asked Sep 02 '26 16:09

korada


1 Answers

Check this out modifying the execjs runtimes.rb fixed it for me per:

https://github.com/sstephenson/execjs/issues/81

The fix I made was to edit lib/execjs/runtimes.rb (under the execjs gem's path...c:\Ruby192\lib\ruby\gems\1.9.1\gems\execjs-1.3.0 on my machine) so that the JScript runtime is defined like so:

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

Issue seems to be with JS runtime in Windows 8. Not exactly sure what the deal is. There are probably a few ways to resolve it, install node.js, therubyracer, something like that. But this did the trick.

like image 50
M Kessler Avatar answered Sep 05 '26 05:09

M Kessler