'Trying to deploy rails app to Heroku, but I'm getting this error message midway through it building "! [remote rejected] (pre-receive hook declined)"
I am following along with Ruby on Rails Tutorial and have followed everything step-by-step. However when I put in
git push heroku main
It puts out this
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-20 stack
remote: -----> Determining which buildpack to use for this app
remote: ! Warning: Multiple default buildpacks reported the ability to handle this app. The first buildpack in the list below will be used.
remote: Detected buildpacks: Ruby,Node.js
remote: See https://devcenter.heroku.com/articles/buildpacks#buildpack-detect-order
remote: -----> Ruby app detected
remote: -----> Installing bundler 2.2.33
remote: -----> Removing BUNDLED WITH version in the Gemfile.lock
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.7.5
remote: -----> Installing dependencies using bundler 2.2.33
remote: Running: BUNDLE_WITHOUT='development:test' BUNDLE_PATH=vendor/bundle BUNDLE_BIN=vendor/bundle/bin BUNDLE_DEPLOYMENT=1 bundle install -j4
remote: Fetching gem metadata from https://rubygems.org/..........
remote: Fetching rake 13.0.6
remote: Installing rake 13.0.6
remote: Fetching concurrent-ruby 1.1.9
remote: Fetching minitest 5.15.0
remote: Fetching zeitwerk 2.5.4
remote: Fetching builder 3.2.4
remote: Installing builder 3.2.4
remote: Installing zeitwerk 2.5.4
remote: Installing minitest 5.15.0
remote: Installing concurrent-ruby 1.1.9
remote: Fetching erubi 1.10.0
remote: Fetching racc 1.6.0
remote: Installing erubi 1.10.0
remote: Fetching crass 1.0.6
remote: Fetching rack 2.2.3
remote: Installing racc 1.6.0 with native extensions
remote: Installing crass 1.0.6
remote: Fetching nio4r 2.5.8
remote: Installing rack 2.2.3
remote: Installing nio4r 2.5.8 with native extensions
remote: Fetching marcel 1.0.2
remote: Fetching websocket-extensions 0.1.5
remote: Installing websocket-extensions 0.1.5
remote: Installing marcel 1.0.2
remote: Fetching mini_mime 1.1.2
remote: Fetching msgpack 1.4.4
remote: Installing mini_mime 1.1.2
remote: Installing msgpack 1.4.4 with native extensions
remote: Using bundler 2.2.33
remote: Fetching ffi 1.15.5
remote: Installing ffi 1.15.5 with native extensions
remote: Fetching method_source 1.0.0
remote: Installing method_source 1.0.0
remote: Fetching pg 1.2.3
remote: Installing pg 1.2.3 with native extensions
remote: Fetching thor 1.2.1
remote: Installing thor 1.2.1
remote: Fetching tilt 2.0.10
remote: Installing tilt 2.0.10
remote: Fetching semantic_range 3.0.0
remote: Installing semantic_range 3.0.0
remote: Fetching turbolinks-source 5.2.0
remote: Installing turbolinks-source 5.2.0
remote: Fetching i18n 1.9.1
remote: Installing i18n 1.9.1
remote: Fetching tzinfo 2.0.4
remote: Installing tzinfo 2.0.4
remote: Fetching rack-test 1.1.0
remote: Installing rack-test 1.1.0
remote: Fetching rack-proxy 0.7.2
remote: Installing rack-proxy 0.7.2
remote: Fetching sprockets 4.0.2
remote: Installing sprockets 4.0.2
remote: Fetching websocket-driver 0.7.5
remote: Installing websocket-driver 0.7.5 with native extensions
remote: Fetching mail 2.7.1
remote: Installing mail 2.7.1
remote: Fetching nokogiri 1.13.1 (x86_64-linux)
remote: Installing nokogiri 1.13.1 (x86_64-linux)
remote: Fetching puma 5.3.1
remote: Installing puma 5.3.1 with native extensions
remote: Fetching turbolinks 5.2.1
remote: Installing turbolinks 5.2.1
remote: Fetching activesupport 6.1.4.1
remote: Installing activesupport 6.1.4.1
remote: Fetching bootsnap 1.7.2
remote: Installing bootsnap 1.7.2 with native extensions
remote: Fetching loofah 2.13.0
remote: Installing loofah 2.13.0
remote: Fetching sassc 2.4.0
remote: Installing sassc 2.4.0 with native extensions
remote: Fetching rails-dom-testing 2.0.3
remote: Installing rails-dom-testing 2.0.3
remote: Fetching globalid 1.0.0
remote: Installing globalid 1.0.0
remote: Fetching activemodel 6.1.4.1
remote: Installing activemodel 6.1.4.1
remote: Fetching jbuilder 2.10.0
remote: Installing jbuilder 2.10.0
remote: Fetching rails-html-sanitizer 1.4.2
remote: Installing rails-html-sanitizer 1.4.2
remote: Fetching activejob 6.1.4.1
remote: Installing activejob 6.1.4.1
remote: Fetching activerecord 6.1.4.1
remote: Installing activerecord 6.1.4.1
remote: Fetching actionview 6.1.4.1
remote: Installing actionview 6.1.4.1
remote: Fetching actionpack 6.1.4.1
remote: Installing actionpack 6.1.4.1
remote: Fetching actioncable 6.1.4.1
remote: Installing actioncable 6.1.4.1
remote: Fetching activestorage 6.1.4.1
remote: Installing activestorage 6.1.4.1
remote: Fetching actionmailer 6.1.4.1
remote: Installing actionmailer 6.1.4.1
remote: Fetching railties 6.1.4.1
remote: Installing railties 6.1.4.1
remote: Fetching sprockets-rails 3.4.2
remote: Installing sprockets-rails 3.4.2
remote: Fetching actionmailbox 6.1.4.1
remote: Installing actionmailbox 6.1.4.1
remote: Fetching actiontext 6.1.4.1
remote: Installing actiontext 6.1.4.1
remote: Fetching webpacker 5.4.0
remote: Installing webpacker 5.4.0
remote: Fetching rails 6.1.4.1
remote: Installing rails 6.1.4.1
remote: Fetching sassc-rails 2.1.2
remote: Installing sassc-rails 2.1.2
remote: Fetching sass-rails 6.0.0
remote: Installing sass-rails 6.0.0
remote: Bundle complete! 17 Gemfile dependencies, 56 gems now installed.
remote: Gems in the groups 'development' and 'test' were not installed.
remote: Bundled gems are installed into `./vendor/bundle`
remote: Bundle completed (174.62s)
remote: Cleaning up the bundler cache.
remote: -----> Installing node-v16.13.1-linux-x64
remote: -----> Installing yarn-v1.22.17
remote: -----> Detecting rake tasks
remote: -----> Preparing app for Rails asset pipeline
remote: Running: rake assets:precompile
remote: rake aborted!
remote: NoMethodError: undefined method `group' for #<HelloApp::Application:0x0000559c74bae1e8>
remote: /tmp/build_8540a8d0/config/environments/production.rb:5:in `block in <main>'
remote: /tmp/build_8540a8d0/vendor/bundle/ruby/2.7.0/gems/railties-6.1.4.1/lib/rails/railtie.rb:234:in `instance_eval'
remote: /tmp/build_8540a8d0/vendor/bundle/ruby/2.7.0/gems/railties-6.1.4.1/lib/rails/railtie.rb:234:in `configure'
remote: /tmp/build_8540a8d0/config/environments/production.rb:3:in `<main>'
remote: /tmp/build_8540a8d0/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
remote: /tmp/build_8540a8d0/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
remote: /tmp/build_8540a8d0/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
remote: /tmp/build_8540a8d0/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
remote: /tmp/build_8540a8d0/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
remote: /tmp/build_8540a8d0/vendor/bundle/ruby/2.7.0/gems/zeitwerk-2.5.4/lib/zeitwerk/kernel.rb:35:in `require'
remote: /tmp/build_8540a8d0/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:332:in `block in require'
remote: /tmp/build_8540a8d0/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:299:in `load_dependency'
remote: /tmp/build_8540a8d0/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:332:in `require'
remote: /tmp/build_8540a8d0/vendor/bundle/ruby/2.7.0/gems/railties-6.1.4.1/lib/rails/engine.rb:571:in `block (2 levels) in <class:Engine>'
remote: /tmp/build_8540a8d0/vendor/bundle/ruby/2.7.0/gems/railties-6.1.4.1/lib/rails/engine.rb:570:in `each'
remote: /tmp/build_8540a8d0/vendor/bundle/ruby/2.7.0/gems/railties-6.1.4.1/lib/rails/engine.rb:570:in `block in <class:Engine>'
remote: /tmp/build_8540a8d0/vendor/bundle/ruby/2.7.0/gems/railties-6.1.4.1/lib/rails/initializable.rb:32:in `instance_exec'
remote: /tmp/build_8540a8d0/vendor/bundle/ruby/2.7.0/gems/railties-6.1.4.1/lib/rails/initializable.rb:32:in `run'
remote: /tmp/build_8540a8d0/vendor/bundle/ruby/2.7.0/gems/railties-6.1.4.1/lib/rails/initializable.rb:61:in `block in run_initializers'
remote: /tmp/build_8540a8d0/vendor/bundle/ruby/2.7.0/gems/railties-6.1.4.1/lib/rails/initializable.rb:50:in `each'
remote: /tmp/build_8540a8d0/vendor/bundle/ruby/2.7.0/gems/railties-6.1.4.1/lib/rails/initializable.rb:50:in `tsort_each_child'
remote: /tmp/build_8540a8d0/vendor/bundle/ruby/2.7.0/gems/railties-6.1.4.1/lib/rails/initializable.rb:60:in `run_initializers'
remote: /tmp/build_8540a8d0/vendor/bundle/ruby/2.7.0/gems/railties-6.1.4.1/lib/rails/application.rb:391:in `initialize!'
remote: /tmp/build_8540a8d0/config/environment.rb:5:in `<main>'
remote: /tmp/build_8540a8d0/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
remote: /tmp/build_8540a8d0/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
remote: /tmp/build_8540a8d0/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
remote: /tmp/build_8540a8d0/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
remote: /tmp/build_8540a8d0/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
remote: /tmp/build_8540a8d0/vendor/bundle/ruby/2.7.0/gems/zeitwerk-2.5.4/lib/zeitwerk/kernel.rb:35:in `require'
remote: /tmp/build_8540a8d0/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:332:in `block in require'
remote: /tmp/build_8540a8d0/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:299:in `load_dependency'
remote: /tmp/build_8540a8d0/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:332:in `require'
remote: /tmp/build_8540a8d0/vendor/bundle/ruby/2.7.0/gems/railties-6.1.4.1/lib/rails/application.rb:367:in `require_environment!'
remote: /tmp/build_8540a8d0/vendor/bundle/ruby/2.7.0/gems/railties-6.1.4.1/lib/rails/application.rb:533:in `block in run_tasks_blocks'
remote: /tmp/build_8540a8d0/vendor/bundle/ruby/2.7.0/gems/sprockets-rails-3.4.2/lib/sprockets/rails/task.rb:61:in `block (2 levels) in define'
remote: Tasks: TOP => environment
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: !
remote: ! ## Warning - The same version of this code has already been built: e3c6e5a9acce3bb652ab8579c32c736a61f7381a
remote: !
remote: ! We have detected that you have triggered a build from source code with version e3c6e5a9acce3bb652ab8579c32c736a61f7381a
remote: ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch.
remote: !
remote: ! If you are developing on a branch and deploying via git you must run:
remote: !
remote: ! git push heroku <branchname>:main
remote: !
remote: ! This article goes into details on the behavior:
remote: ! https://devcenter.heroku.com/articles/duplicate-build-version
remote:
remote: Verifying deploy...
remote:
remote: ! Push rejected to secret-atoll-24278.
remote:
To https://git.heroku.com/secret-atoll-24278.git
! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/secret-atoll-24278.git'
I'm new to Ruby and Heroku, so I'm having a hard time finding the difference between standard error messages and the ones that get to the root of the issue.
It's recognizing that it's a Ruby app, but it's getting tripped up somewhere along the way. Any ideas?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
