简体   繁体   English

Heroku rake资产:预编译无法编译Rails应用程序

[英]Heroku rake assets:precompile failed to compile Rails app

I haven't made any changes to my assets and now all of a sudden when I perform a git push heroku master it aborts on rake assets:precompile 我没有对我的资产进行任何更改,现在突然间,当我执行git push heroku master时,它会对rake资产中止:precompile

...

Preparing app for Rails asset pipeline
Running: rake assets:precompile
I, [2014-03-14T18:30:05.776041 #675]  INFO -- : Writing /tmp/build_f664cf41-71b7-435d-b85e-8f607080a4d3/public/assets/application-0a41bdbc9b8fc13f1e62a69634eb2c98.js
rake aborted!
wrong number of arguments (2 for 1)
(in /tmp/build_f664cf41-71b7-435d-b85e-8f607080a4d3/app/assets/stylesheets/application.css.scss)
/tmp/build_f664cf41-71b7-435d-b85e-8f607080a4d3/vendor/bundle/ruby/2.0.0/gems/sass-3.2.14/lib/sass/importers/filesystem.rb:16:in `initialize'
/tmp/build_f664cf41-71b7-435d-b85e-8f607080a4d3/vendor/bundle/ruby/2.0.0/gems/sprockets-2.12.0/lib/sprockets/sass_importer.rb:11:in `initialize'

...

Tasks: TOP => assets:precompile
(See full trace by running task with --trace)
!
!     Precompiling assets failed.
!

!     Push rejected, failed to compile Ruby app

It looks like it's breaking on wrong number of arguments (2 for 1) in assets/stylesheets/application.css.scss . 它看起来像是在资产/样式表/ application.css.scss中 错误的参数数量(2比1) But I don't have any methods in my stylesheets. 但我的样式表中没有任何方法。 Here's that file: 这是那个文件:

/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the top of the
* compiled file, but it's generally better to create a new file per style scope.
*
*= require_self
*= require_tree .
*/

In my assets/stylesheets/custom.css.scss I have this at the top: 在我的assets / stylesheets / custom.css.scss中,我在顶部有这个:

@import 'bootstrap';
@import 'bootstrap-responsive';

In my config/application.rb file I have: 在我的config / application.rb文件中,我有:

config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif)
config.assets.initialize_on_precompile = false

I've performed a heroku run rake assets:clobber and that didn't help. 我已经执行了一个heroku运行rake资产:clobber ,但没有帮助。

Locally my app works and functions perfectly fine. 本地我的应用程序工作和功能完美。

Here's some Gems I'm using for reference: 这是我用来参考的一些宝石:

gem 'sass-rails'
gem 'bootstrap-sass', '2.3.2.0'
gem 'rails_12factor'
gem 'compass_rails'
gem 'jquery-rails'
gem 'rails', '4.0.2'

Any ideas? 有任何想法吗?

Ok. 好。 I found out the problem. 我发现了问题。

gem 'sass-rails' was using version 3.2.14 . gem'sass-rails'使用版本3.2.14 By updating to 4.0.2 I was able to precompile my assets while deploying to Heroku. 通过更新到4.0.2,我可以在部署到Heroku时预编译我的资产。

All is well. 一切都很好。

Just add/modify Gemfile dependecy sass-rails like this 只需像这样添加/修改Gemfile dependecy sass-rails

gem 'sass-rails', '4.0.2'

That modification solved the problem in my case. 这个修改解决了我的问题。

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

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