Search code examples
ruby-on-railsherokucompilationassets

Rails Heroku deploy: Precompiling assets failed. SassC::SyntaxError


I get an error "Precompiling assets failed" during deploy to heroku RoR project.

I tried to find css code with "calc(100vh - 110px)", but didn't find anything in the project.

What could be the issue? Thank you

remote: -----> Installing node-v20.9.0-linux-x64
remote: -----> Installing yarn-v1.22.19
remote: -----> Detecting rake tasks
remote: -----> Preparing app for Rails asset pipeline
remote:        Running: rake assets:precompile
remote:        yarn install v1.22.19
remote:        [1/4] Resolving packages...
remote:        [2/4] Fetching packages...
remote:        [3/4] Linking dependencies...
remote:        warning " > [email protected]" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
remote:        warning "webpack-dev-server > [email protected]" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
remote:        [4/4] Building fresh packages...
remote:        Done in 15.09s.
remote:        rake aborted!
remote:        SassC::SyntaxError: Error: "calc(100vh - 110px)" is not a number for `min'
remote:                on line 1:30534 of stdin, in function `min`
remote:                from line 1:30534 of stdin
remote:        >> x;flex:1;flex-direction:column;max-height:min(650px,calc(100vh - 110px));ove
remote:           ------------------------------------------^
remote:        stdin:1

I did try to run rails assets:precompile:

    Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call `DidYouMean.correct_error(error_name, spell_checker)' instead.
    /Users/olegmishyn/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/set.rb:648: warning: already initialized constant Set::InspectKey
    /Users/olegmishyn/.rvm/gems/ruby-3.0.0/gems/set-1.0.3/lib/set.rb:815: warning: previous definition of InspectKey was here
    /Users/olegmishyn/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/pathname.rb:20: warning: already initialized constant Pathname::TO_PATH
    /Users/olegmishyn/.rvm/gems/ruby-3.0.0/gems/pathname-0.2.1/lib/pathname.rb:20: warning: previous definition of TO_PATH was here
    /Users/olegmishyn/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/pathname.rb:22: warning: already initialized constant Pathname::SAME_PATHS
    /Users/olegmishyn/.rvm/gems/ruby-3.0.0/gems/pathname-0.2.1/lib/pathname.rb:22: warning: previous definition of SAME_PATHS was here
    /Users/olegmishyn/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/pathname.rb:34: warning: already initialized constant Pathname::SEPARATOR_LIST
    /Users/olegmishyn/.rvm/gems/ruby-3.0.0/gems/pathname-0.2.1/lib/pathname.rb:34: warning: previous definition of SEPARATOR_LIST was here
    /Users/olegmishyn/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/pathname.rb:35: warning: already initialized constant Pathname::SEPARATOR_PAT
    /Users/olegmishyn/.rvm/gems/ruby-3.0.0/gems/pathname-0.2.1/lib/pathname.rb:35: warning: previous definition of SEPARATOR_PAT was here
    /Users/olegmishyn/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/pathname.rb:41: warning: already initialized constant Pathname::ABSOLUTE_PATH
    /Users/olegmishyn/.rvm/gems/ruby-3.0.0/gems/pathname-0.2.1/lib/pathname.rb:41: warning: previous definition of ABSOLUTE_PATH was here
    Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call `DidYouMean.correct_error(error_name, spell_checker)' instead.
    /Users/olegmishyn/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/set.rb:648: warning: already initialized constant Set::InspectKey
    /Users/olegmishyn/.rvm/gems/ruby-3.0.0/gems/set-1.0.3/lib/set.rb:815: warning: previous definition of InspectKey was here
    Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call `DidYouMean.correct_error(error_name, spell_checker)' instead.
    /Users/olegmishyn/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/set.rb:648: warning: already initialized constant Set::InspectKey
    /Users/olegmishyn/.rvm/gems/ruby-3.0.0/gems/set-1.0.3/lib/set.rb:815: warning: previous definition of InspectKey was here
    yarn install v1.22.15
    warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
    [1/4] 🔍  Resolving packages...
    success Already up-to-date.
    ✨  Done in 0.15s.
    Warning: you are using an unstable release of Node.js (v21.2.0). If you encounter issues with Node.js, consider switching to an Active LTS release. More info: https://docs.npmjs.com/try-the-latest-stable-version-of-node
    Everything's up-to-date. Nothing to do

Also I tried: RAILS_ENV=production rails assets:precompile

olegmishyn@MacBook-Air-Oleg learnician % RAILS_ENV=production rails assets:precompile SECRET_KEY_BASE='07788fabf3594bf7c2d898acfd331bb39294bb613c2609e9d2966cd5593a3cb0131be5ce5165de67a10f24ade4bf45e5d74e80104beb79404f0f441b93e46eff'

Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call `DidYouMean.correct_error(error_name, spell_checker)' instead.
/Users/olegmishyn/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/set.rb:648: warning: already initialized constant Set::InspectKey
/Users/olegmishyn/.rvm/gems/ruby-3.0.0/gems/set-1.0.3/lib/set.rb:815: warning: previous definition of InspectKey was here
/Users/olegmishyn/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/pathname.rb:20: warning: already initialized constant Pathname::TO_PATH
/Users/olegmishyn/.rvm/gems/ruby-3.0.0/gems/pathname-0.2.1/lib/pathname.rb:20: warning: previous definition of TO_PATH was here
/Users/olegmishyn/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/pathname.rb:22: warning: already initialized constant Pathname::SAME_PATHS
/Users/olegmishyn/.rvm/gems/ruby-3.0.0/gems/pathname-0.2.1/lib/pathname.rb:22: warning: previous definition of SAME_PATHS was here
/Users/olegmishyn/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/pathname.rb:34: warning: already initialized constant Pathname::SEPARATOR_LIST
/Users/olegmishyn/.rvm/gems/ruby-3.0.0/gems/pathname-0.2.1/lib/pathname.rb:34: warning: previous definition of SEPARATOR_LIST was here
/Users/olegmishyn/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/pathname.rb:35: warning: already initialized constant Pathname::SEPARATOR_PAT
/Users/olegmishyn/.rvm/gems/ruby-3.0.0/gems/pathname-0.2.1/lib/pathname.rb:35: warning: previous definition of SEPARATOR_PAT was here
/Users/olegmishyn/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/pathname.rb:41: warning: already initialized constant Pathname::ABSOLUTE_PATH
/Users/olegmishyn/.rvm/gems/ruby-3.0.0/gems/pathname-0.2.1/lib/pathname.rb:41: warning: previous definition of ABSOLUTE_PATH was here
Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call `DidYouMean.correct_error(error_name, spell_checker)' instead.
/Users/olegmishyn/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/set.rb:648: warning: already initialized constant Set::InspectKey
/Users/olegmishyn/.rvm/gems/ruby-3.0.0/gems/set-1.0.3/lib/set.rb:815: warning: previous definition of InspectKey was here
Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call `DidYouMean.correct_error(error_name, spell_checker)' instead.
/Users/olegmishyn/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/set.rb:648: warning: already initialized constant Set::InspectKey
/Users/olegmishyn/.rvm/gems/ruby-3.0.0/gems/set-1.0.3/lib/set.rb:815: warning: previous definition of InspectKey was here
yarn install v1.22.15
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/4] 🔍  Resolving packages...
success Already up-to-date.
✨  Done in 0.15s.
rails aborted!
SassC::SyntaxError: Error: "calc(100vh - 110px)" is not a number for `min'
        on line 1:30534 of stdin, in function `min`
        from line 1:30534 of stdin
>> x;flex:1;flex-direction:column;max-height:min(650px,calc(100vh - 110px));ove
   ------------------------------------------^

Tasks: TOP => assets:precompile
(See full trace by running task with --trace)

Solution

  • fixed it by adding config.assets.css_compressor = nil to application.rb and production.rb + changed node.js version to "engines": { "node": "16.13.1" } In package.json