为什么rails不显示网页

时间:2016-01-10 06:25:22

标签: ruby-on-rails testing webpage

每次启动rails应用程序时,服务器都会显示错误消息。例如(这是来自命令行):

Started GET "/" for 127.0.0.1 at 2016-01-10 00:12:31 -0600
Processing by WelcomeController#index as HTML
Rendered welcome/index.html.erb within layouts/application (3.0ms)
Completed 500 Internal Server Error in 2054ms

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)):
3: <head>
4:   <title>AlphaBlog</title>
5:   <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track' => true %>
6:   <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
7:   <%= csrf_meta_tags %>
8: </head>
9: <body>
app/views/layouts/application.html.erb:6:in `_app_views_layouts_application_html_erb___602047428_59662224'


Rendered c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.1.8/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (2.0ms)
Rendered c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.1.8/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (1.0ms)
Rendered c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.1.8/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb within rescues/layout (64.8ms)

如何解决此问题?

2 个答案:

答案 0 :(得分:0)

尝试删除javascript_include_tag(表示为已损坏的行)并查看页面是否加载。如果页面加载了,那么关于javascript的资产文件可能有问题。

答案 1 :(得分:0)

第一种解决方法。这一行添加到文件application.js

//= require turbolinks

解决问题的第二种方法。 Gemfile 1.8.0的{​​{1}}版本gem 'coffee-script-source'

gem 'coffee-script-source', '1.8.0'