From what I can find online, it looks like this error could be caused by corrupted files in the vendor
folder.
I assume you already tried deleting everything and re-starting. You could try once more and run composer clearcache
before starting.
If that still doesn't help, if you create a new folder elsewhere on the server and try installing Flarum in that new folder, does it work?
Could you also check what is your command line PHP version? You can find it out by running php -v