When deploying Rails 6 sites to Heroku, the Ruby buildpack would detect if the webpacker gem was installed and install yarn for you automatically. With Rails 7, webpacker is no longer installed by default, so using jsbundling-rails and extras that require yarn to be installed will cause deployment errors on Heroku.
The fix is to install the nodejs buildpack. This needs to be done before the ruby buildpack. As follows:
heroku buildpacks:clear heroku buildpacks:set heroku/nodejs heroku buildpacks:add heroku/ruby
After running these commands your deployment to Heroku will work great.