Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

martio's avatar

Cannot redeclare composerRequire during deployment

I use the Laravel Vapor and I have an error during deployment. Support doesn't help me...

Output of composer diagnose:

Checking composer.json: OK
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com rate limit: OK
Checking disk free space: OK
Composer version: 1.10.1
PHP version: 7.4.4
PHP binary path: /usr/bin/php7.4
OpenSSL version: OpenSSL 1.1.1d  10 Sep 2019

When I run this command:

vapor deploy staging

I get the following output:

The command "composer install --classmap-authoritative" failed.                                                                                            
                                                                                                                                                             
  Exit Code: 255(Unknown error)                                                                                                                              
                                                                                                                                                             
  Working directory: /var/www/.vapor/build/app                                                                                                               
                                                                                                                                                             
  Output:                                                                                                                                                    
  ================                                                                                                                                           
  ocramius/package-versions: Generating version class...                                                                                                     
  ocramius/package-versions: ...done generating version class                                                                                                
                                                                                                                                                             
  Fatal error: Cannot redeclare composerRequire3769093da9969960d08bc382b84551a8() (previously declared in /var/www/vendor/composer/autoload_real.php:66) in  
   /var/www/.vapor/build/app/vendor/composer/autoload_real.php on line 57                                                                                    
                                                                                                                                                             
                                                                                                                                                             
  Error Output:                                                                                                                                              
  ================                                                                                                                                           
  Loading composer repositories with package information                                                                                                     
  Installing dependencies (including require-dev) from lock file                                                                                             
  Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. It is recommended that you r  
  un `composer update` or `composer update <package name>`.                                                                                                  
  Nothing to install or update                                                                                                                               
  Package jakub-onderka/php-console-color is abandoned, you should avoid using it. Use php-parallel-lint/php-console-color instead.                          
  Package jakub-onderka/php-console-highlighter is abandoned, you should avoid using it. Use php-parallel-lint/php-console-highlighter instead.              
  Package moontoast/math is abandoned, you should avoid using it. Use brick/math instead.                                                                    
  Generating optimized autoload files                                                                                                                        
  > Illuminate\Foundation\ComposerScripts::postAutoloadDump                                                                                                  
  PHP Fatal error:  Cannot redeclare composerRequire3769093da9969960d08bc382b84551a8() (previously declared in /var/www/vendor/composer/autoload_real.php:6  
  6) in /var/www/.vapor/build/app/vendor/composer/autoload_real.php on line 57
0 likes
3 replies
martio's avatar

I'm usign the Laravel app, not the Drupal :)

Please or to participate in this conversation.