Rails Heroku deployment fails: Could not find gems, Failed to install gems via Bundler

So I have a Rails application that I am trying to push to Heroku. When I run git push heroku master, I get:

$ git push heroku master
Enumerating objects: 1369, done.
Counting objects: 100% (1369/1369), done.
Delta compression using up to 12 threads
Compressing objects: 100% (906/906), done.
Writing objects: 100% (1369/1369), 35.15 MiB | 1.66 MiB/s, done.
Total 1369 (delta 755), reused 829 (delta 398), pack-reused 0 (from 0)
remote: Resolving deltas: 100% (755/755), done.
remote: Updated 169 paths from d8b5ada
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Building on the Heroku-22 stack
remote: -----> Using buildpack: heroku/ruby
remote: -----> Ruby app detected
remote: -----> Installing bundler 2.5.6
remote: -----> Removing BUNDLED WITH version in the Gemfile.lock
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-3.2.2
remote: -----> Installing dependencies using bundler 2.5.6
remote:        Running: BUNDLE_WITHOUT='development:test' BUNDLE_PATH=vendor/bundle BUNDLE_BIN=vendor/bundle/bin BUNDLE_DEPLOYMENT=1 bundle install -j4
remote:        Could not find rails-7.1.3.4, sprockets-rails-3.5.1, pg-1.5.6, puma-6.0.2,
remote:        importmap-rails-2.0.1, turbo-rails-2.0.5, stimulus-rails-1.3.3, jbuilder-2.12.0,
remote:        tzinfo-data-1.2024.1, bootsnap-1.18.3, sendgrid-ruby-6.7.0, devise-4.9.4,
remote:        letter_opener-1.10.0, activerecord-7.1.3.4, actiontext-7.1.3.4,
remote:        htmlbeautifier-1.4.3, base64-0.2.0, bigdecimal-3.1.8, mutex_m-0.2.0,
remote:        tailwindcss-rails-2.6.1, actioncable-7.1.3.4, actionmailbox-7.1.3.4,
remote:        actionmailer-7.1.3.4, actionpack-7.1.3.4, actionview-7.1.3.4, activejob-7.1.3.4,
remote:        activemodel-7.1.3.4, activestorage-7.1.3.4, activesupport-7.1.3.4,
remote:        railties-7.1.3.4, sprockets-4.2.1, nio4r-2.7.3, tzinfo-2.0.6, msgpack-1.7.2,
remote:        ruby_http_client-3.5.5, bcrypt-3.1.20, responders-3.1.1, launchy-3.0.1,
remote:        timeout-0.4.1, globalid-1.2.1, nokogiri-1.16.6, mini_magick-4.13.1,
remote:        ruby-vips-2.2.1, websocket-driver-0.7.6, zeitwerk-2.6.16, mail-2.8.1,
remote:        net-imap-0.4.14, net-smtp-0.5.0, rails-dom-testing-2.2.0, racc-1.8.0,
remote:        rack-3.1.6, rack-session-2.0.0, rack-test-2.1.0, rails-html-sanitizer-1.6.0,
remote:        builder-3.3.0, erubi-1.13.0, marcel-1.0.4, concurrent-ruby-1.3.3,
remote:        connection_pool-2.4.1, drb-2.2.1, i18n-1.14.5, minitest-5.24.1, irb-1.13.2,
remote:        rackup-2.1.0, rake-13.2.1, thor-1.3.1, addressable-2.8.7, childprocess-5.0.0,
remote:        mini_portile2-2.8.7, ffi-1.17.0, mini_mime-1.1.5, date-3.3.4,
remote:        net-protocol-0.2.2, loofah-2.22.0, rdoc-6.7.0, reline-0.5.9, webrick-1.8.1,
remote:        public_suffix-6.0.0, psych-5.1.2, io-console-0.7.2, stringio-3.1.1 in cached
remote:        gems or installed locally
remote:        Bundler Output: Could not find rails-7.1.3.4, sprockets-rails-3.5.1, pg-1.5.6, puma-6.0.2,
remote:        importmap-rails-2.0.1, turbo-rails-2.0.5, stimulus-rails-1.3.3, jbuilder-2.12.0,
remote:        tzinfo-data-1.2024.1, bootsnap-1.18.3, sendgrid-ruby-6.7.0, devise-4.9.4,
remote:        letter_opener-1.10.0, activerecord-7.1.3.4, actiontext-7.1.3.4,
remote:        htmlbeautifier-1.4.3, base64-0.2.0, bigdecimal-3.1.8, mutex_m-0.2.0,
remote:        tailwindcss-rails-2.6.1, actioncable-7.1.3.4, actionmailbox-7.1.3.4,
remote:        actionmailer-7.1.3.4, actionpack-7.1.3.4, actionview-7.1.3.4, activejob-7.1.3.4,
remote:        activemodel-7.1.3.4, activestorage-7.1.3.4, activesupport-7.1.3.4,
remote:        railties-7.1.3.4, sprockets-4.2.1, nio4r-2.7.3, tzinfo-2.0.6, msgpack-1.7.2,
remote:        ruby_http_client-3.5.5, bcrypt-3.1.20, responders-3.1.1, launchy-3.0.1,
remote:        timeout-0.4.1, globalid-1.2.1, nokogiri-1.16.6, mini_magick-4.13.1,
remote:        ruby-vips-2.2.1, websocket-driver-0.7.6, zeitwerk-2.6.16, mail-2.8.1,
remote:        net-imap-0.4.14, net-smtp-0.5.0, rails-dom-testing-2.2.0, racc-1.8.0,
remote:        rack-3.1.6, rack-session-2.0.0, rack-test-2.1.0, rails-html-sanitizer-1.6.0,
remote:        builder-3.3.0, erubi-1.13.0, marcel-1.0.4, concurrent-ruby-1.3.3,
remote:        connection_pool-2.4.1, drb-2.2.1, i18n-1.14.5, minitest-5.24.1, irb-1.13.2,
remote:        rackup-2.1.0, rake-13.2.1, thor-1.3.1, addressable-2.8.7, childprocess-5.0.0,
remote:        mini_portile2-2.8.7, ffi-1.17.0, mini_mime-1.1.5, date-3.3.4,
remote:        net-protocol-0.2.2, loofah-2.22.0, rdoc-6.7.0, reline-0.5.9, webrick-1.8.1,
remote:        public_suffix-6.0.0, psych-5.1.2, io-console-0.7.2, stringio-3.1.1 in cached
remote:        gems or installed locally
remote: 
remote:  !
remote:  !     Failed to install gems via Bundler.
remote:  !
remote:  !     Push rejected, failed to compile Ruby app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !       Push rejected to *****.
remote: 
To https://git.heroku.com/*****.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/*****.git'

I have tried the solutions found on this question, but nothing works (I get the same error). Everything runs fine on my local machine, so I don’t know why it is not working on Heroku.

I do also want to ask: Are you supposed to run the commands found on this question from your local server, or from the heroku shell for your app? Because I have tried running the commands from the heroku shell but to no avail:

$ heroku run bash --app *****
Running bash on ⬢ *****... up, run.4316 (Basic)
~ $ bundle install
bash: bundle: command not found

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật