After upgrading Heroku stack from 20 to 22, the nginx buildpack cannot compile nginx.conf.erb. It cannot find the erb executable.
The reason is that I use heroku-buildpack-subdir so that my runtime directory of nginx buildpack is /app/nginx. But this buildpack's compile script adds /app/.heroku-buildpack-nginx/ruby/bin to PATH, assuming that buildpack always lives in /app.
So heroku-buildpack-nginx doesn't work on Heroku stack 22 if you change the buildpack runtime directory from /app.
Now the solution could be to calculate the buildpack runtime directory from BUILD_DIR.