我的 rails 项目中有 vendor.js 文件,其中包含几个供应商库,在添加一些新库后,我在开发环境中遇到了这个问题
Started GET "/assets/vendor.js" for 10.40.129.65 at 2013-03-03 14:01:24 +0400
Cache write: 0d6281da1957dd9c5e063fb636c50bd260dae5e2
Cache read: 0d6281da1957dd9c5e063fb636c50bd260dae5e2
Cache read: http://work:3000/assets/vendor.js?
Cache write: http://work:3000/assets/vendor.js?
!! Rack application returned nil body. Probably you wanted it to be an empty string?
!! Unexpected error while processing request: undefined method `each' for nil:NilClass
尝试删除一些库可以解决问题,并且预编译的资产可以正常工作。但我想让它在开发中工作。请帮帮我。
供应商.js:
//= require ./vendor/ext/stacktrace.js
//= require jquery
//= require jquery_ujs
//= require underscore
//= require backbone
//= require twitter/bootstrap
//= require js_notifier
//= require ./vendor/ext/mustache-1.4.2
//= require ./vendor/ext/strftime
//= require ./vendor/ext/moment
//= require ./vendor/ext/langs.js
//= require ./vendor/ext/jquery.jgrowl_minimized.js
//= require ./vendor/ext/jquery-ui-1.10.0.custom.min.js
//= require ./vendor/ext/jquery-ui-sliderAccess.js
//= require ./vendor/ext/jquery-ui-timepicker-addon.js
//= require ./vendor/ext/backbone.paginator.js
//= require ./vendor/ext/jquery-deparam.min.js
//= require ./vendor/ext/select2.js
//= require_tree ./templates
//= require ./vendor/channels.js.coffee
//= require ./vendor/ext/bootstrap.switch.js
//= require ./vendor/ext/private_pub
//= require ./vendor/ext/spin.js
//= require ./vendor/ext/jquery.spin.js
我正在使用 Memcached + Dalli
UPD:我已经在每个环境中明确设置了 cache_store(developemnt.rb、production.rb 和 test.rb),这解决了问题,直到我打开谷歌浏览器再次出现问题。结果,在 FF 中一切正常,Chrome 无法加载 vendor.js(相同的服务器实例(瘦)并且在同一时间用于两个浏览器)
记录 ff 请求:
Cache read: http://work:3000/assets/vendor.js?
Cache read: 577d6ed0d98975b583329c312bd25667620f2497
记录 chrome 请求(同上):
Started GET "/assets/vendor.js" for 10.40.129.65 at 2013-03-03 20:37:11 +0400
Cache write: 577d6ed0d98975b583329c312bd25667620f2497
Cache read: 577d6ed0d98975b583329c312bd25667620f2497
Cache read: http://work:3000/assets/vendor.js?
Cache write: http://work:3000/assets/vendor.js?
!! Rack application returned nil body. Probably you wanted it to be an empty string?
!! Unexpected error while processing request: undefined method `each' for nil:NilClass