The only fix for this I've ever found was to use Composer 2. MediaWiki 1.39 is apparently not compatible with Composer 1.
They provide instructions at https://getcomposer.org/download/ . You can download and run it without installing it, and without replacing Composer 1 in your system.
If this isn't acceptable, I'm afraid you're out of luck.