[英]Why rails isn't displaying a web page
Each time I launch a rails application, the server displays an error message. 每次启动Rails应用程序时,服务器都会显示一条错误消息。 For instance (this is from the command line):
例如(从命令行):
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)
How do I fix this issue? 如何解决此问题?
Try removing the javascript_include_tag (line indicated as broken) and see if the page loads. 尝试删除javascript_include_tag(标为虚线的行),然后查看页面是否加载。 If the page does load, then it maybe something wrong with the assets files regarding javascript.
如果页面确实加载,则关于javascript的资产文件可能有问题。
The first way to solve. 解决的第一种方法。 Add to file
application.js
this line: 将以下行添加到文件
application.js
:
//= require turbolinks
The second method of solving. 第二种解决方法。 In
Gemfile
set version 1.8.0
for gem 'coffee-script-source'
: 在
Gemfile
为Gemfile
gem 'coffee-script-source'
设置版本1.8.0
:
gem 'coffee-script-source', '1.8.0'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.