【问题标题】:Heroku push rake assets fail suddenly using precompileHeroku push rake assets 使用预编译突然失败
【发布时间】:2019-07-28 02:55:03
【问题描述】:

执行“git push heroku master”时出现错误。
我使用以下方法在本地编译资产:

rake assets:precompile RAILS_ENV=production --trace

问题是,这在过去几个月里一直在正常工作,直到昨天才决定失败。

我还尝试了以下方法从头开始重新编译,结果相同:

rake assets:clobber --trace
rake assets:precompile RAILS_ENV=production --trace

不确定如何调试。我最近的签入看起来很合理(即我没有编辑配置文件或 rakefile 等)。我正在更改一些 png 图像(新图像,调整图像大小),但在本地预编译似乎没有显示任何错误。

这是错误消息的开始。

remote: -----> Detecting rails configuration
remote: -----> Detecting rake tasks
remote:
remote:  !
remote:  !     Could not detect rake tasks
remote:  !     ensure you can run `$ bundle exec rake -P` against your app
remote:  !     and using the production group of your Gemfile.
remote:  !     /tmp/build_a612be38eac01922e9ad7a0a8c37a351/vendor/bundle/ruby/2.2.0/gems/autoprefixer-rails-9.4.10/lib/autoprefixer-rails/processor.rb:83: warning: else without rescue is useless
remote:  !     rake aborted!
remote:  !     SyntaxError: /tmp/build_a612be38eac01922e9ad7a0a8c37a351/vendor/bundle/ruby/2.2.0/gems/autoprefixer-rails-9.4.10/lib/autoprefixer-rails/processor.rb:79: syntax error, unexpected '.'
remote:  !     from ||= if defined? Rails&.respond_to?(:root) && Rails&.root
remote:  !     ^
remote:  !     /tmp/build_a612be38eac01922e9ad7a0a8c37a351/vendor/bundle/ruby/2.2.0/gems/autoprefixer-rails-9.4.10/lib/autoprefixer-rails/processor.rb:79: syntax error, unexpected '.'
remote:  !     from ||= if defined? Rails&.respond_to?(:root) && Rails&.root
remote:  !     ^

【问题讨论】:

    标签: ruby-on-rails heroku asset-pipeline


    【解决方案1】:

    令人讨厌的是,这个问题在花了一整天的时间尝试修复/研究后就消失了。第二天一切正常,我不知道为什么。我做的最后一件事是在我的 production.rb 中注释掉一行,构建所有内容,然后将其取消注释。不确定它是否相关。仅供参考,这条线是:

    config.assets.precompile += ['landing.js', 'landing.css']
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-09-05
      • 1970-01-01
      • 2023-03-17
      • 1970-01-01
      • 2017-01-25
      • 2021-01-07
      • 2015-08-12
      相关资源
      最近更新 更多