【问题标题】:Can't push to heroku, sassc segmentation fault无法推送到heroku,sassc分段错误
【发布时间】:2021-06-29 18:43:50
【问题描述】:

我在推送到 heroku 时遇到问题,我已经尝试过其他与 预编译资产失败相关的解决方案。,例如修改 application.rb 以禁用预编译资产、运行 rake assets:precompile 并更新到rails 6.3.1 以防止 mimemagic 最近的错误。

查看heroku日志,我注意到:

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]

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

【问题讨论】:

    标签: ruby-on-rails ruby heroku


    【解决方案1】:

    基于同一个线程,我发现这个解决方案比降级一堆宝石更合适。

    把它放在你的 initializers/assets.rb 的顶部使资产能够成功编译

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

    仍然是 hack,但另一种选择。

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

    【讨论】:

      【解决方案2】:

      这似乎是问题133197 中报告的最新错误

      One solution 是使用旧的 sassc 版本。特别是,我尝试过:

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

      效果很好。所有可用版本均为listed here

      【讨论】:

        猜你喜欢
        • 2020-10-24
        • 2016-12-14
        • 1970-01-01
        • 2016-07-23
        相关资源
        最近更新 更多