【问题标题】:Ruby keeps giving unkown error messgeRuby 不断给出未知的错误信息
【发布时间】:2015-11-02 00:06:34
【问题描述】:

我终于修复了程序中的大部分错误,但 Ruby on Rails 命令提示符一直给我同样的错误信息:

``1) Error:
StaticPagesControllerTest#test_should_get_about:
ActionView::Template::Error: TypeError: Object doesn't support this property    or method
(in C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/turbolinks-    2.5.3/lib/assets/javascripts/turbolinks.js.coffee)
app/views/layouts/application.html.erb:7:in `   _app_views_layouts_application_html_erb__148079984_48137160'
test/controllers/static_pages_controller_test.rb:17:in `block in  <class:StaticPagesControllerTest>'


2) Error:
StaticPagesControllerTest#test_should_get_contact:
ActionView::Template::Error: TypeError: Object doesn't support this property   or method
(in C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/turbolinks-2.5.3/lib/assets/javascripts/turbolinks.js.coffee)
app/views/layouts/application.html.erb:7:in `_app_views_layouts_application_html_erb__148079984_48137160'
test/controllers/static_pages_controller_test.rb:23:in `block in <class:StaticPagesControllerTest>'


 3) Error:
 StaticPagesControllerTest#test_should_get_help:
 ActionView::Template::Error: TypeError: Object doesn't support this   property or method
 (in C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/turbolinks-2.5.3/lib/assets/javascripts/turbolinks.js.coffee)
 app/views/layouts/application.html.erb:7:in `_app_views_layouts_application_html_erb__148079984_48137160'
 test/controllers/static_pages_controller_test.rb:11:in `block in <class:StaticPagesControllerTest>'


 4) Error:
 StaticPagesControllerTest#test_should_get_home:
 ActionView::Template::Error: TypeError: Object doesn't support this property or method
 (in C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/turbolinks-2.5.3/lib/assets/javascripts/turbolinks.js.coffee)
 app/views/layouts/application.html.erb:7:in `_app_views_layouts_application_html_erb__148079984_48137160'
 test/controllers/static_pages_controller_test.rb:5:in `block in <class:StaticPagesControllerTest>'

我该如何解决这个问题?如果不解决此问题,我将无法进入我的应用程序。

【问题讨论】:

  • 您在 Windows 上吗?请出示您的Gemfileapplication.js 文件。
  • 我在 Windows 上,但目前我的 rails 应用程序没有 application.js 文件。 gemfile 不能在 cmets 中显示。
  • Windows 有一个已知问题(gem 'coffee-script-source' in 1.9.0)。看到这个答案:stackoverflow.com/a/29609359/981183这也应该解决你的问题......

标签: ruby-on-rails ruby testing error-handling syntax-error


【解决方案1】:

这更可能是 coffee-script 版本 1.9.0+ gem 错误,请使用 gem 'coffee-script-source', '1.8.0'(将其放在您的 Gemfile 中)。不要忘记运行 bundle

【讨论】:

  • 这不会损害程序。我只是问,因为我不想再对程序造成任何损害。
  • 没有。它将使用另一个版本的coffee-script gem。
  • 好的,所以它更新了coffee-script-source,但现在它给了我四次失败。
  • @metaco57 - 它们是否失败并显示相同的错误消息?顺便说一句 - 放弃 windows,它会让你的开发者的生活很痛苦。
  • 我不知道任何使用 Windows 的优秀 Rails 开发人员。这是因为有些 gem 甚至无法在 Windows 上运行
猜你喜欢
  • 2016-08-23
  • 1970-01-01
  • 2011-01-27
  • 1970-01-01
  • 2020-10-30
  • 2015-06-22
  • 1970-01-01
  • 2014-10-06
  • 1970-01-01
相关资源
最近更新 更多