What’s likely going on here is that Node 16 reached end of life on 2022-04-30, and current versions of yarn now depend on you running a more recent version of node. We had another user with the same error: New error popping up when I to deploy my rails app after making some minor text changes - #7 by mchilson
The fix that worked for them was to update the Node version used. It may also be possible to specify that you want an older version of yarn.