简体   繁体   English

指南针宝石不能在heroku中运行?

[英]compass-rails gem not being run in heroku?

My gemfile recently upgraded my compass-rails gem. 我的gemfile最近升级了我的指南针-gem。 I started getting the following error (production on heroku only - works fine locally), and have been stuck on it for hours: 我开始遇到以下错误(仅在heroku上生产-在本地可以正常运行),并已停留了几个小时:

Completed 500 Internal Server Error in 14284ms
2012-09-03T20:53:25+00:00 app[web.1]: 
2012-09-03T20:53:25+00:00 app[web.1]: ActionView::Template::Error (File to import not found or unreadable: compass/css3.
2012-09-03T20:53:25+00:00 app[web.1]: Load path: Sass::Rails::Importer(/app/app/assets/stylesheets/application.css.scss)

I think part of the problem must lie within the fact the /app/app/ is appearing in the path here - but I dont understand why. 我认为问题的部分原因必须在于/ app / app /出现在此处的路径中-但我不明白为什么。 When I change the compass config below, to "assets/stylesheets" I still see /app/app/ in the trace error. 当我将下面的指南针配置更改为“资产/样式表”时,在跟踪错误中我仍然看到/ app / app /。

production.rb: production.rb:

  # Don't fallback to assets pipeline if a precompiled asset is missed
  config.assets.compile = false

compass.rb 罗盘

# Require any additional compass plugins here.
project_type = :rails
sass_dir = "app/assets/stylesheets"

Gemfile 宝石文件

group :assets do
  gem 'sass-rails'
  gem 'coffee-rails'
  gem 'uglifier', '1.2.4'
  gem 'yui-compressor', '0.9.6'
  gem 'compass-rails'
end

In my application.css.scss file: 在我的application.css.scss文件中:

@import "compass/css3";

I've been trying every solution I can find without any luck so far 到目前为止,我一直在尝试可以找到的所有解决方案,但没有任何运气

Anything sticking out? 有什么突出吗?

Yes, moving compass-rails out of :assets works but is not an ideal solution. 是的,将罗盘导轨移出:assets可以,但是不是理想的解决方案。

Checking through the output from the push to heroku I found 通过检查推送到我发现的heroku的输出

Preparing app for Rails asset pipeline
Running: rake assets:precompile
rake aborted!

But it is compiling locally with 但是它正在本地编译

RAILS_ENV=production rake assets:precompile

The solution is not to instantiate the DB when precompiling assets. 解决方案是在预编译资产时不实例化数据库。 In config/application.rb: 在config / application.rb中:

config.assets.initialize_on_precompile = false

See this issue in the compass-rails project: 在指南针项目中查看此问题:

https://github.com/Compass/compass-rails/issues/19 https://github.com/Compass/compass-rails/issues/19

I upgraded my rails to 3.2+ and ended up moving compass-rails outside of the assets group to make it work. 我将滑轨升级到3.2+,并最终将指南针滑轨移到资产组之外以使其正常运行。 I dont really understand why it works, but it seemed to do the trick. 我真的不明白为什么它起作用,但是它似乎可以解决问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM