我有一个Rails 3.2.3应用程序不能始终如一地加载JS文件。我刚开始研究JS,所以我不确定这是不是刚刚开始,或者是因为我几天前开始使用它。
另外两个从事这个项目的人根本没有任何问题。但有时它会加载我的所有文件,有时会跳过一些文件,似乎没有任何模式。
有时会加载app.js,有时则不会。与其他js文件相同。
我在rails日志中看到以下内容多次出现:
错误的请求行`'。
我在这里不知所措......
的application.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 `'.
答案 0 :(得分:2)
我有同样的问题,JS和CSS文件随机无法在谷歌浏览器中加载,这个错误显示在日志中:
ERROR bad Request-Line `'.
问题必须与cookie有关,但删除cookie对我不起作用。我通过在config/initializers/session_store.rb
中重命名密钥来解决问题,然后在问题消失后重新命名。奇怪。