简体   繁体   English

无法推送到 heroku,sass 分段错误

[英]Can't push to heroku, sassc segmentation fault

I am having trouble pushing to heroku, I've already tried others solutions related to Precompiling assets failed.我无法推送到 heroku,我已经尝试过其他与预编译资产失败相关的解决方案。 , like modifing application.rb to disable precompiled assets, running rake assets:precompile , and updating to rails 6.3.1 to prevent mimemagic recent error. ,比如修改application.rb以禁用预编译资产,运行rake assets:precompile ,并更新到 rails 6.3.1 以防止 mimemagic 最近的错误。

Taking a look at heroku logs, I noticed:查看 heroku 日志,我注意到:

tmp/build_7857ebbd/vendor/bundle/ruby/3.0.0/gems/sassc-2.4.0/lib/sassc/engine.rb:43: [BUG] Segmentation fault at 0x0000000000000000 ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux] tmp/build_7857ebbd/vendor/bundle/ruby/3.0.0/gems/sassc-2.4.0/lib/sassc/engine.rb:43:[BUG] 0x0000000000000000 处的分段错误 ruby 3.0.0p0(2020-12-25 修订版) 95aff21468) [x86_64-linux]

Part of heroku's log heroku的日志的一部分

       ...
       yarn install v1.22.4
       [1/4] Resolving packages...
       [2/4] Fetching packages...
       info fsevents@2.1.3: The platform "linux" is incompatible with this module.
       info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
       info fsevents@1.2.13: The platform "linux" is incompatible with this module.
       info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
       [3/4] Linking dependencies...
       [4/4] Building fresh packages...
       Done in 5.07s.
       /tmp/build_7857ebbd/vendor/bundle/ruby/3.0.0/gems/sassc-2.4.0/lib/sassc/engine.rb:43: [BUG] Segmentation fault at 0x0000000000000000
       ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux]
       
       -- Control frame information -----------------------------------------------
       c:0042 p:---- s:0308 e:000307 CFUNC  :compile_data_context
       c:0041 p:0314 s:0303 e:000302 METHOD /tmp/build_7857ebbd/vendor/bundle/ruby/3.0.0/gems/sassc-2.4.0/lib/sassc/engine.rb:43
       c:0040 p:0044 s:0291 e:000290 METHOD /tmp/build_7857ebbd/vendor/bundle/ruby/3.0.0/gems/sassc-rails-2.1.2/lib/sassc/rails/compressor.rb:29
       c:0039 p:0007 s:0285 e:000284 METHOD /tmp/build_7857ebbd/vendor/bundle/ruby/3.0.0/gems/sprockets-4.0.2/lib/sprockets/sass_compressor.rb:30
       c:0038 p:0047 s:0280 e:000279 METHOD /tmp/build_7857ebbd/vendor/bundle/ruby/3.0.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:84
       c:0037 p:0014 s:0272 e:000271 BLOCK  /tmp/build_7857ebbd/vendor/bundle/ruby/3.0.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:66 [FINISH]
       .....
       c:0036 p:---- s:0267 e:000266 CFUNC  :reverse_each
  7f104d3bd000-7f104d3be000 rw-p 00000000 00:00 0 
       7fffab4a6000-7fffac4a5000 rw-p 00000000 00:00 0                          [stack]
       7fffac503000-7fffac505000 r--p 00000000 00:00 0                          [vvar]
       7fffac505000-7fffac507000 r-xp 00000000 00:00 0                          [vdso]
       ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
       
       
       Aborted
 !
 !     Precompiling assets failed.
 !
 !     Push rejected, failed to compile Ruby app.
 !     Push failed

Based on the same thread, I found this solution more suitable than downgrading a bunch of gems.基于相同的线程,我发现这个解决方案比降级一堆宝石更合适。

Putting this at the top of your initializers/assets.rb enabled the assets to compile successfully把它放在你的 initializers/assets.rb 的顶部使资产能够成功编译

# config/initializers/assets.rb
Rails.application.config.assets.configure do |env|
  env.export_concurrent = false
end

Still a hack, but another option.仍然是黑客,但另一种选择。

Source: https://github.com/sass/sassc-ruby/issues/197#issuecomment-735359755资料来源: https://github.com/sass/sassc-ruby/issues/197#issuecomment-735359755

It seems to be a recent bug as reported in issue 133 and 197这似乎是问题133197中报告的最新错误

One solution is to use an older sassc version. 一种解决方案是使用较旧的 sassc 版本。 In particular, I've tried:特别是,我试过:

gem 'sassc', '~> 2.0', '>= 2.0.1'
gem 'sprockets', '~> 3.7.2'
gem 'sass-rails', '~> 5.1.0 ' 
gem 'concurrent-ruby',  '~>1.1.5'

Which works just fine.哪个工作得很好。 All available versions are listed here此处列出了所有可用版本

I've seen sassc segmentation fault errors before when upgrading between Ruby versions on heroku (in this case it was from Ruby 3.1.0 to 3.1.1).我之前在 heroku 上的 Ruby 版本之间升级时看到过 sass 分段错误(在本例中是从 Ruby 3.1.0 到 3.1.1)。 I recommend trying two things first:我建议先尝试两件事:

  1. Make sure you can precompile production assets locally RAILS_ENV=production rails assets:precompile确保您可以在本地预编译生产资产RAILS_ENV=production rails assets:precompile
  2. Clear the Heroku build cache:清除 Heroku 构建缓存:
    • Install heroku-repo plugin heroku plugins:install heroku-repo安装 heroku-repo 插件heroku plugins:install heroku-repo
    • heroku repo:purge_cache -a appname
    • redeploy to Heroku重新部署到 Heroku

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

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