对于我来说,在本地运行似乎很完美,在100MB内存下,对于Heroku服务器的Dyno来说似乎是不可能完成的任务......
如何在任务本身中找出导致此内存吞噬的原因?
$heroku run bundle exec rake assets:precompile -a myapp
Running `rake assets:precompile` attached to terminal... 2014-09-21T22:35:19.129047+00:00 heroku[api]: Starting process with command `bundle exec rake assets:precompile` by example@domain.com
up, run.3387
2014-09-21T22:35:38.348540+00:00 heroku[run.3387]: Awaiting client
2014-09-21T22:35:38.410272+00:00 heroku[run.3387]: Starting process with command `bundle exec rake assets:precompile`
2014-09-21T22:35:38.489421+00:00 heroku[run.3387]: State changed from starting to up
RSpec is not part of this bundle, skip specs.
Warning. Error encountered while saving cache /app/.sass-cache/cce550dafbc86189868cd4c9d7eaf6d5c3eab036/application.sassc: can't dump anonymous class #<Class:0x007f009904f9e8>
2014-09-21T22:36:04.665412+00:00 heroku[run.3387]: Process running mem=687M(134.3%)
2014-09-21T22:36:04.665737+00:00 heroku[run.3387]: Error R14 (Memory quota exceeded)
2014-09-21T22:36:24.743579+00:00 heroku[run.3387]: Process running mem=689M(134.7%)
2014-09-21T22:36:24.743579+00:00 heroku[run.3387]: Error R14 (Memory quota exceeded)
2014-09-21T22:36:44.586205+00:00 heroku[run.3387]: Process running mem=691M(135.0%)
2014-09-21T22:36:44.586205+00:00 heroku[run.3387]: Error R14 (Memory quota exceeded)
“ls -la”似乎列出了在部署成功时编译的正确资产。但是,当应用程序启动时,Sprockets无法找到public / assets / *中包含的文件,这可能是权限错误吗?
答案 0 :(得分:0)
解决方案:
来自Heroku支持:
你好, 在构建slug时,看起来资产编译没有成功完成:
Running: rake assets:precompile
RSpec is not part of this bundle, skip specs.
Warning. Error encountered while saving cache /tmp/build_c2c58e6a-e133-4fa2-8ad1-29d0e1a3f106/.sass-cache/b8f882ea75af7a30f0356eee89e2cb5703efe81b/application.sassc: can't dump anonymous class #<Class:0x007fd865e70118>
Asset precompilation completed (20.48s)
您可能比我更了解应用程序的资产管道。构建看起来相当大,它正在拉动JVM,我猜测它是'yui-compressor'?您可能想考虑使用Java远离宝石。我们必须拖入JVM并占用大量磁盘空间。这可能是这里发生的事情。如果没有JVM,您将拥有更多可用于资产编译的磁盘。
在Sprockets中使用:scss as css_compressor选项解决了这个问题,结果几乎相同。