'I'm getting Class 'PackageVersions\Versions' not found after running php artisan

I'm using MacOs. And have a Laravel project. Running composer update produces

 Class 'PackageVersions\Versions' not found

Running composer install same thing. And even php artisan without any other thing produces the same result. The only thing that didn't produce an error is composer update --no-scripts

My php version is 7.4, Laravel version is 5.8. Composer version is 2.3.2

This is more from the log before the error is produced after composer update

Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

In base.php line 145:
                                              
  Class 'PackageVersions\Versions' not found  
                                              

Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1

This is the list of my composer packages on the require param

"require": {
    "php": "^7.1.3",
    "doctrine/dbal": "^2.9",
    "eduardokum/laravel-mail-auto-embed": "^1.0",
    "fideloper/proxy": "^4.0",
    "guzzlehttp/guzzle": "^6.3",
    "laravel/framework": "5.8.*",
    "laravel/tinker": "^1.0"
},


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source