3

我有一个 Rails 3.2.3 应用程序无法始终加载 JS 文件。我刚开始研究 JS,所以我不确定这是刚刚开始,还是从我几天前开始就一直这样。

从事该项目的另外两个人根本没有任何问题。但有时它会加载我所有的文件,有时它会跳过一些文件,似乎没有任何模式。

有时它会加载 app.js,有时则不会。与其他 js 文件相同。

我在 Rails 日志中多次看到以下内容:

错误错误请求行`'。

我在这里不知所措...

应用程序.js:

//= require jquery
//= require jquery_ujs
//= require util
//= require app
//= require_tree .

以下是日志文件显示的内容:

Started GET "/assets/user_manager.js?body=1" for 127.0.0.1 at 2012-11-07 18:02:13 -0500
Served asset /user_manager.js - 200 OK (0ms)


Started GET "/assets/util.js?body=1" for 127.0.0.1 at 2012-11-07 18:02:13 -0500
Served asset /util.js - 200 OK (0ms)
[2012-11-07 18:02:13] ERROR bad Request-Line `'.
[2012-11-07 18:02:13] ERROR bad Request-Line `'.
[2012-11-07 18:02:13] ERROR bad Request-Line `'.


Started GET "/assets/header/topnav/separator.png" for 127.0.0.1 at 2012-11-07 18:02:13 -0500
Served asset /header/topnav/separator.png - 200 OK (0ms)


Started GET "/assets/header/pagetitle-bg.png" for 127.0.0.1 at 2012-11-07 18:02:13 -0500
Served asset /header/pagetitle-bg.png - 200 OK (0ms)
[2012-11-07 18:02:13] ERROR bad Request-Line `'.


Started GET "/assets/header_bg.png" for 127.0.0.1 at 2012-11-07 18:02:13 -0500
Served asset /header_bg.png - 404 Not Found (3ms)

ActionController::RoutingError (No route matches [GET] "/assets/header_bg.png"):
  actionpack (3.2.3) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
  actionpack (3.2.3) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
  railties (3.2.3) lib/rails/rack/logger.rb:26:in `call_app'
  railties (3.2.3) lib/rails/rack/logger.rb:16:in `call'
  actionpack (3.2.3) lib/action_dispatch/middleware/request_id.rb:22:in `call'
  rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
  rack (1.4.1) lib/rack/runtime.rb:17:in `call'
  activesupport (3.2.3) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
  rack (1.4.1) lib/rack/lock.rb:15:in `call'
  actionpack (3.2.3) lib/action_dispatch/middleware/static.rb:62:in `call'
  railties (3.2.3) lib/rails/engine.rb:479:in `call'
  railties (3.2.3) lib/rails/application.rb:220:in `call'
  rack (1.4.1) lib/rack/c[2012-11-07 18:02:13] ERROR bad Request-Line `'.
ontent_length.rb:14:in `call'
  railties (3.2.3) lib/rails/rack/log_tailer.rb:14:in `call'
  rack (1.4.1) lib/rack/handler/webrick.rb:59:in `service'
  /Users/rob/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
  /Users/rob/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
  /Users/rob/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/webrick/server.rb:191:in `block in     start_thread'


  Rendered /Users/rob/.rvm/gems/ruby-1.9.3-p125@admin/gems/actionpack-3.2.    3/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (1.1ms)


Started GET "/assets/background/header_blueprint.png" for 127.0.0.1 at 2012-11-07 18:02:13 -0500
Served asset /background/header_blueprint.png - 200 OK (0ms)


Started GET "/assets/images/ui-icons_454545_256x240.png" for 127.0.0.1 at 2012-11-07 18:02:13 -0500
Served asset /images/ui-icons_454545_256x240.png - 404 Not Found (3ms)

ActionController::RoutingError (No route matches [GET] "/assets/images/ui-icons_454545_256x240.png"):
  actionpack (3.2.3) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
  actionpack (3.2.3) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
  railties (3.2.3) lib/rails/rack/logger.rb:26:in `call_app'
  railties (3.2.3) lib/rails/rack/logger.rb:16:in `call'
  actionpack (3.2.3) lib/action_dispatch/middleware/request_id.rb:22:in `call'
  rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
  rack (1.4.1) lib/rack/runtime.rb:17:in `call'
  activesupport (3.2.3) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
  rack (1.4.1) lib/rack/lock.rb:15:in `call'
  actionpack (3.2.3) lib/action_dispatch/middleware/static.rb:62:in `call'
  railties (3.2.3) lib/rails/engine.rb:479:in `call'
  railties (3.2.3) lib/rails/application.rb:220:in `call'
  rack (1.4.1) lib/rack/content_length.rb:14:in `call'
  railties (3.2.3) lib/rails/rack/log_tailer.rb:14:in `call'
  rack (1.4.1) lib/rack/handler/webrick.rb:59:in `service'
  /Users/rob/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
  /Users/rob/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
  /Users/rob/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/webrick/server.rb:191:in `block in     start_thread'


  Rendered /Users/rob/.rvm/gems/ruby-1.9.3-p125@admin/gems/actionpack-3.2.    3/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (0.8ms)
[2012-11-07 18:02:13] ERROR bad Request-Line `'.
[2012-11-07 18:02:13] ERROR bad Request-Line `'.
[2012-11-07 18:02:13] ERROR bad Request-Line `'.    
4

1 回答 1

2

我遇到了同样的问题,JS 和 CSS 文件随机无法在 Google Chrome 中加载,日志中显示此错误:

ERROR bad Request-Line `'.

问题一定与 cookie 有关,但删除 cookie 对我不起作用。我通过重命名他们的密钥来解决问题,config/initializers/session_store.rb然后在问题消失后将其重命名。奇怪的。

于 2013-03-08T15:20:13.963 回答