【问题标题】:Precompiling assets failed and rake aborted预编译资产失败并且 rake 中止
【发布时间】:2016-03-31 02:33:50
【问题描述】:

您好,我尝试将我的 ruby​​ on rails 应用程序部署到 heroku,这是我的错误

remote:        Tasks: TOP => assets:precompile
remote:        (See full trace by running task with --trace)
remote:  !
remote:  !     Precompiling assets failed.
remote:  !
remote:
remote:  !     Push rejected, failed to compile Ruby app
remote:
remote: Verifying deploy....
remote:
remote: !       Push rejected to whispering-peak-4064.
remote:
To https://git.heroku.com/whispering-peak-4064.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/whispering-peak-4064.git'

我在这里看到了很多解决方案,我尝试运行这些命令:

  • RAILS_ENV=production bundle exec rake assets:precompile
  • rake asset:precompile

我的 rake 被中止了!

我按照这里找到的一些答案添加到我的config\application.rb

require 'sprockets/railtie'
config.assets.initialize_on_precompile = false

但我仍然有同样的问题。

PS:我使用的是 Rails 4.2.5

【问题讨论】:

  • 本地预编译有效吗? RAILS_ENV=production bundle exec rake assets:precompile
  • 是的,这就是我让 rake 中止的原因!未设置 Devise.secret_key。请注意以下添加到您的设计initializ ER:config.secret_key =“dec618466f8a54a49e974325ccad03142a81235c32a5282b3294c9198 8ba06ccfde11f8ada06ba6a23c7bf37819811849bfeeaf2338b4093467331d862cb4a0d”请确保您在安装设计或设置键后重新启动您的应用程序 SPAN>。
  • 好的,在你将它添加到config/initializers/devise.rb 之后?
  • 是的,我得到了这个:我,[2015-12-24T19:40:32.645619 #6452] INFO -- : Writing C:/rubyy/forum/public/assets/applici on-9af8837e067e591b79c64f805ab6e96697b44269937acccfcdfae js I,[2015-12-24T19:40:32.890633 #6452] INFO -- : 写 C:/rubyy/forum/public/assets/application-9af8837e067e591b79c64f805ab6e96697b442699ba41cfcd18ac684e37bc7fa.js.gz! Sass::SyntaxError: Invalid CSS after " content: ": 预期表达式(例如 1px,粗体),是 " : " ";" (sass):27 任务: TOP => assets:precompile (通过使用 --trace 运行任务查看完整跟踪)
  • 看起来像一个无效的扩展名,你在某处使用 .sass 而不是 .scss 吗?你能发布完整的跟踪吗?

标签: ruby-on-rails ruby-on-rails-4 heroku ruby-on-rails-3.2 rubygems


【解决方案1】:

我认为这行导致您的错误:

.clearfix:before, .clearfix:after { content: : " "; display: table; }

应该是

.clearfix:before, .clearfix:after { content: " "; display: table; }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-08-12
    • 2013-03-10
    • 1970-01-01
    • 2012-02-22
    • 1970-01-01
    相关资源
    最近更新 更多