3

我在 Windows 7 笔记本电脑上有一个完美的开发环境。今天,我得到了一台新的 Windows 8 笔记本电脑,并试图在上面设置开发环境。安装了 rails 等并创建了新的示例应用程序,它运行良好。然后我克隆了我的应用程序并尝试了。收到以下错误:

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

我用谷歌搜索并搜索了 javascript_include_tag 并查看了许多线程,但无法找到解决方案。

感谢解决此问题的任何帮助。

环境信息:

$rails -v
Rails 3.2.7

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

编辑:我刚刚注意到当我有咖啡脚本文件甚至是一个空文件时会出现这个问题。我仍然不知道如何解决它。

4

2 回答 2

8

检查这个修改 execjs runtimes.rb 为我修复它:

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

我所做的修复是编辑 lib/execjs/runtimes.rb (在我的机器上的 execjs gem 的路径下...c:\Ruby192\lib\ruby\gems\1.9.1\gems\execjs-1.3.0)所以JScript 运行时的定义如下:

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

问题似乎与 Windows 8 中的 JS 运行时有关。不完全确定交易是什么。可能有几种方法可以解决它,安装 node.js、therubyracer 之类的。但这成功了。

于 2012-12-21T00:19:35.180 回答
1

In your application.js if you change the "application" to "default" it will start working. I dont know why but it does.

Reading application.js it feels as if the page will try to seek turbolinks.js in the assets/javascripts/ folder but can't find that file. When we change it from application to default , it pulls the turbolinks from a default location for the Ruby, not for the application. Just my assumption.

于 2013-10-10T03:21:09.827 回答