Ruby on rails Heroku:保存缓存时遇到错误

Ruby on rails Heroku:保存缓存时遇到错误,ruby-on-rails,ruby-on-rails-3,heroku,Ruby On Rails,Ruby On Rails 3,Heroku,本地一切正常,但推到Heroku时: Warning. Error encountered while saving cache /tmp/build_1b5c442a-d24e-4f80-9755-a0bd15d7f029/tmp/cache/sass/bc1b787c8640c68bf42fc69efbef227d36428060/_carousel.scssc: can't dump anonymous class #<Class:0x007f2583f02288>

本地一切正常,但推到Heroku时:

   Warning. Error encountered while saving cache /tmp/build_1b5c442a-d24e-4f80-9755-a0bd15d7f029/tmp/cache/sass/bc1b787c8640c68bf42fc69efbef227d36428060/_carousel.scssc: can't dump anonymous class #<Class:0x007f2583f02288>
   Warning. Error encountered while saving cache /tmp/build_1b5c442a-d24e-4f80-9755-a0bd15d7f029/tmp/cache/sass/bc1b787c8640c68bf42fc69efbef227d36428060/_hero-unit.scssc: can't dump anonymous class #<Class:0x007f2583f02288>
   Warning. Error encountered while saving cache /tmp/build_1b5c442a-d24e-4f80-9755-a0bd15d7f029/tmp/cache/sass/bc1b787c8640c68bf42fc69efbef227d36428060/_utilities.scssc: can't dump anonymous class #<Class:0x007f2583f02288>
   Warning. Error encountered while saving cache /tmp/build_1b5c442a-d24e-4f80-9755-a0bd15d7f029/tmp/cache/sass/5b1569a9810eac207f22942f2921f0820863a2d6/exams.css.scssc: can't dump anonymous class #<Class:0x007f2583f02288>
   Warning. Error encountered while saving cache /tmp/build_1b5c442a-d24e-4f80-9755-a0bd15d7f029/tmp/cache/sass/5b1569a9810eac207f22942f2921f0820863a2d6/home.css.scssc: can't dump anonymous class #<Class:0x007f2583f02288>
   Warning. Error encountered while saving cache /tmp/build_1b5c442a-d24e-4f80-9755-a0bd15d7f029/tmp/cache/sass/5b1569a9810eac207f22942f2921f0820863a2d6/lessons.css.scssc: can't dump anonymous class #<Class:0x007f2583f02288>
   Warning. Error encountered while saving cache /tmp/build_1b5c442a-d24e-4f80-9755-a0bd15d7f029/tmp/cache/sass/5b1569a9810eac207f22942f2921f0820863a2d6/questions.css.scssc: can't dump anonymous class #<Class:0x007f2583f02288>
   Warning. Error encountered while saving cache /tmp/build_1b5c442a-d24e-4f80-9755-a0bd15d7f029/tmp/cache/sass/5b1569a9810eac207f22942f2921f0820863a2d6/scaffolds.css.scssc: can't dump anonymous class #<Class:0x007f2583f02288>
   Warning. Error encountered while saving cache /tmp/build_1b5c442a-d24e-4f80-9755-a0bd15d7f029/tmp/cache/sass/5b1569a9810eac207f22942f2921f0820863a2d6/sections.css.scssc: can't dump anonymous class #<Class:0x007f2583f02288>
My production.rb文件已启用以下属性

  config.cache_classes = true

  config.consider_all_requests_local       = false
  config.action_controller.perform_caching = true

  config.serve_static_assets = true

  config.assets.compress = true
  config.assets.compile = false

  config.assets.digest = true
  config.assets.initialize_on_precompile = false

我的rails版本是rails 3.2.11

这与最近将sass gem升级到3.3.0有关。sass gem是几个其他sass gem的依赖项,因此即使您的Gemfile中没有它,它也可能正在被加载。在本地和Heroku上做一个“捆绑展示”,我敢肯定你会看到它们是不同的版本(sass几天前刚刚升级到3.3.0)

加:

到您的GEM文件,这将为您解决问题。然后在github上提交一个关于这个gem的问题


希望这有帮助,它对我有用

这是Sass 3.3.0中的一个已知错误,链轮导入器未序列化,因此无法缓存,导致此错误。有关错误报告,请参阅。如果没有缓存,Sass的编译速度非常慢,这会导致heroku服务器超时。

首先您可能需要更新

bundle update sass-rails
bundle update sass
然后是更关键的部分(确保在Gemfile.lock中卸载sass版本)


在我这方面也看到了同样的情况,除了我的应用程序最终编译并启动,而且似乎运行良好(我想我的错误并没有导致它超过15分钟的超时时间)。这是我第一次推。不知道他们有没有什么东西?你已经和Heroku建立了一张票了吗?我的应用没有重大变化,所以我不认为我弄坏了任何东西。这对你有用吗?如果这对你有用,请标记为已接受的答案。谢谢@bcb我最终做的是在本地预编译资产,然后推送。为我工作。虽然这有点令人沮丧,因为1。我们不知道什么时候才能拆除2号线。我不知道我是否应该在
组中添加这一行:assets
…也为我工作。。真烦人。。。字体很棒的sass-rails,sass-rails。sass-rails特别不锁定sass版本。谢谢。在3.2.19中,这种情况仍然发生:(。对我来说,它们不是不同的版本。但我仍然得到这个错误。
  config.cache_classes = true

  config.consider_all_requests_local       = false
  config.action_controller.perform_caching = true

  config.serve_static_assets = true

  config.assets.compress = true
  config.assets.compile = false

  config.assets.digest = true
  config.assets.initialize_on_precompile = false
gem 'sass', '3.2.13'
bundle update sass-rails
bundle update sass
gem uninstall sass
bundle install