使用预编译时,Heroku推送rake资产突然失败

问题描述 投票:0回答:1

当我做'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个回答
0
投票

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

config.assets.precompile += ['landing.js', 'landing.css']
© www.soinside.com 2019 - 2024. All rights reserved.