本质上我的问题是页面加载良好并且看起来正常。大约30秒后它突然消失。
这是错误发生之前的服务器日志(加载页面时):
Started GET "/" for 127.0.0.1 at 2014-03-11 23:53:30 -0400
Processing by PagesController#home as HTML
Rendered pages/home.html.erb within layouts/application (0.7ms)
Rendered layouts/_head.erb (3.3ms)
Rendered layouts/_header.erb (0.9ms)
Rendered layouts/_footer.erb (0.2ms)
Completed 200 OK in 11ms (Views: 10.5ms)
Started GET "/assets/favicon.ico" for 127.0.0.1 at 2014-03-11 23:53:30 -0400
Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2014-03-11 23:53:30 -0400
Started GET "/assets/home.css?body=1" for 127.0.0.1 at 2014-03-11 23:53:30 -0400
Started GET "/assets/taylor.jpg" for 127.0.0.1 at 2014-03-11 23:53:30 -0400
Started GET "/assets/wide.jpg" for 127.0.0.1 at 2014-03-11 23:53:30 -0400
Started GET "/assets/enchanted_large.png" for 127.0.0.1 at 2014-03-11 23:53:30 -0400
Started GET "/assets/sad.jpg" for 127.0.0.1 at 2014-03-11 23:53:30 -0400
然后图像突然消失并出现客户端错误(在 Chrome 的开发控制台中看到):
Failed to load resource: net::ERR_CONTENT_LENGTH_MISMATCH
http://localhost:3000/assets/taylor.jpg
日志中唯一添加的是:
Started GET "/assets/favicon.ico" for 127.0.0.1 at 2014-03-11 23:54:00 -0400
在看起来不错的 30 秒内,chrome 在图标所在的位置有一个加载符号
此时我的 html 相当简单:
<div class="home-images">
<%= image_tag "taylor.jpg", class: "home-image" %>
<%= image_tag "wide.jpg", class: "home-image hide" %>
<%= image_tag "sad.jpg", class: "home-image hide" %>
</div>
我什至完全拿出了我的javascript。我也尝试自行删除涡轮链接。它只发生在一张图像上。而且我不知道为什么......
当我切换 html 时,是同一个图像(泰勒)给出了错误:
<div class="home-images">
<%= image_tag "wide.jpg", class: "home-image" %>
<%= image_tag "taylor.jpg", class: "home-image hide" %>
<%= image_tag "sad.jpg", class: "home-image hide" %>
</div>
我的所有图像都位于我的 app/assets/images 文件夹中
我的标题如下所示:
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Enchanting Events and Design</title>
<%= favicon_link_tag "favicon.ico" %>
<%= stylesheet_link_tag "application" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
</head>