javascript_include_tag会抛出不受支持的方法

我最近使用Rails 4.2.0创建了一个新项目,并为着陆页创建了一个名为Land的控制器。 所以,我在访问http://localhost:3000/land/home时遇到了这个错误:

 Started GET "/" for ::1 at 2015-02-27 15:56:23 -0600 Processing by LandController#home as HTML Rendered land/home.html.erb within layouts/application (0.0ms) Completed 500 Internal Server Error in 5526ms ActionView::Template::Error (TypeError: Object doesn't support this property or method (in C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/turbolinks-2.5.3/lib/assets/javascripts/turbolinks.js.coffee)): 3:  4: Course 5:  true %> 6:  7:  8:  9:  app/views/layouts/application.html.erb:6:in `_app_views_layouts_application_html_erb__1279127835_98590860' Rendered C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/web-console-2.0.0/lib/action_dispatch/templates/rescues/_source.erb (5.0ms) Rendered C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/web-console-2.0.0/lib/action_dispatch/templates/rescues/_trace.html.erb (10.0ms) Rendered C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/web-console-2.0.0/lib/action_dispatch/templates/rescues/_request_and_response.html.erb (1.0ms) Rendered C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/web-console-2.0.0/lib/action_dispatch/templates/rescues/_web_console.html.erb (2.0ms) Rendered C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/web-console-2.0.0/lib/action_dispatch/templates/rescues/template_error.html.erb within rescues/layout (72.0ms) 

有没有办法摆脱这个错误? 还是一个bug?

我最近找到了解决这个问题的另一种方案 1.9.0中的1.9.0 gem 'coffee-script-source'Windows上与Rails有一些问题。 我在Gemfile中使用gem’coffee gem 'coffee-script-source', '1.8.0'恢复到以前的版本,这将解决您的问题。

解决此exception的另一种方法是将Node.js安装到您的计算机上,安装并重新启动rails server后错误应该消失。 确保在重新启动终端之前将Node.js添加到PATH中并重新运行服务器。

啊,你似乎失踪了

 //= require turbolinks 

在你的application.js中

在删除turbolinks时看到这一点 (显然,如果你想让它运行,请确保它们全部到位)。

我正在运行Windows 10,Ruby 2.1.7p400和Rails 4.2.4。 我无法获得gem coffee-script-source '1.8.0' source’1.8.0 gem coffee-script-source '1.8.0'作为gem在1.9.1.1版本上坚持安装。 我尝试更改ExecJS以使用UTF-8编码并在没有// U开关的情况下运行cscript,如同在这篇文章中没有任何运气一样。

我最终将nodejs.exe放在Ruby \ bin文件夹中,问题得到了解决。