0

I am getting this error while pushing code on heroku

git push Heroku master

i am getting this error

 remote:        Tasks: TOP => assets:precompile => css:build
    remote:        (See full trace by running task with --trace)
    remote: 
    remote:  !
    remote:  !     Precompiling assets failed.
    remote:  !
    remote:  !     Push rejected, failed to compile Ruby app.
    remote: 
    remote:  !     Push failed
    remote: Verifying deploy...
    remote: 
    remote: !   Push rejected to openlibrarytaskcraft.
    remote: 
    To https://git.heroku.com/openlibrarytaskcraft.git
     ! [remote rejected] master -> master (pre-receive hook declined)
    error: failed to push some refs to 'https://git.heroku.com/openlibrarytaskcraft.git'

I tried precompiling assets by

*rails assets:precompile*

    yarn install v1.22.17
    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.73s.
    yarn run v1.22.17
    error Command "build:css" not found.
    info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
    rails aborted!
    cssbundling-rails: Command css:build failed, ensure yarn is installed and `yarn build:css` runs without errors
    /home/azhar/.rvm/gems/ruby-2.6.5/gems/cssbundling-rails-1.0.0/lib/tasks/cssbundling/build.rake:5:in `block (2 levels) in <main>'
    /home/azhar/.rvm/gems/ruby-2.6.5/gems/railties-6.0.4.4/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
    /home/azhar/.rvm/gems/ruby-2.6.5/gems/railties-6.0.4.4/lib/rails/commands/rake/rake_command.rb:20:in `perform'
    /home/azhar/.rvm/gems/ruby-2.6.5/gems/railties-6.0.4.4/lib/rails/command.rb:48:in `invoke'
    /home/azhar/.rvm/gems/ruby-2.6.5/gems/railties-6.0.4.4/lib/rails/commands.rb:18:in `<main>'
    /home/azhar/.rvm/gems/ruby-2.6.5/gems/bootsnap-1.10.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
    /home/azhar/.rvm/gems/r**strong text**uby-2.6.5/gems/bootsnap-1.10.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
    /home/azhar/Project/Open_library/bin/rails:9:in `<top (required)>'
    /home/azhar/.rvm/gems/ruby-2.6.5/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `load'
    /home/azhar/.rvm/gems/ruby-2.6.5/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `call'
    /home/azhar/.rvm/gems/ruby-2.6.5/gems/spring-2.1.1/lib/spring/client/command.rb:7:in `call'
    /home/azhar/.rvm/gems/ruby-2.6.5/gems/spring-2.1.1/lib/spring/client.rb:30:in `run'
    /home/azhar/.rvm/gems/ruby-2.6.5/gems/spring-2.1.1/bin/spring:49:in `<top (required)>'
    /home/azhar/.rvm/gems/ruby-2.6.5/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `load'
    /home/azhar/.rvm/gems/ruby-2.6.5/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `<top (required)>'
    /home/azhar/Project/Open_library/bin/spring:15:in `require'
    /home/azhar/Project/Open_library/bin/spring:15:in `<top (required)>'
    bin/rails:3:in `load'
    bin/rails:3:in `<main>'
    Tasks: TOP => assets:precompile => css:build
    (See full trace by running task with --trace)

***it says unable to find css:build***

**Even I added this by searching on Github**


    config.assets.initialize_on_precompile = false

please check here is my Gemfile:-

source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '2.6.5'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails', branch: 'main'
gem 'rails', '~> 6.0.4', '>= 6.0.4.4'
# Use sqlite3 as the database for Active Record
#gem 'sqlite3', '~> 1.4'
gem "pg"
# Use Puma as the app server
gem 'puma', '~> 4.1'
# Use SCSS for stylesheets
gem 'sass-rails', '>= 6'
# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
gem 'webpacker', '~> 4.0'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.7'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use Active Model has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Active Storage variant
gem 'image_processing', '~> 1.2'

# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.4.2', require: false

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end

group :development do
  # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
  gem 'web-console', '>= 3.3.0'
  gem 'listen', '~> 3.2'
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'
end

group : test do
  # Adds support for Capybara system testing and selenium driver
  gem 'capybara', '>= 2.15'
  gem 'selenium-web driver
  # Easy installation and use of web drivers to run system tests with browsers
  gem 'webdrivers'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

gem 'devise'

gem 'cssbundling-rails'

gem 'mini_magick', '>= 4.9.5'

gem 'carrierwave', '~> 0.9'

gem 'bootstrap-sass','~> 2.3.2'

gem 'activeadmin'

I have downgraded the Heroku version from 20 to 18 which supports ruby v 2.6.5

I am trying to develop an open library demo project and want to push it to heroku using git

  • I think this same issue has already been tackled [here](https://stackoverflow.com/questions/70482086/rails-7-0-esbuild-running-app-gives-error-command-build-not-found). – Jerry Feb 11 '22 at 07:29
  • nothing was working for me, so I upgraded rails from 6 to 7 and now it's working swimmingly. – Azhar Sheikh Feb 14 '22 at 07:30

0 Answers0