Composer omits some files in the vendor directory

I have a Cake-4 project working on a development server. When I try to move it to a production server, by pulling it from Github, composer fails to load the files in vendor/cakephp/cakephp/src/Error/ that follow the Middleware directory. There are no errors or warnings from the composer run, which is simply :

php composer.phar update

I’ve tried this a couple of times, but this is consistent. The app fails to run because it can’t find Class 'Cake\Error\ErrorTrap.

The stack trace is is follows:

Fatal error : Uncaught Error: Class ‘Cake\Error\ErrorTrap’ not found in /var/www/html/warehouse/config/bootstrap.php:119 Stack trace: #0 /var/www/html/warehouse/vendor/cakephp/cakephp/src/Http/BaseApplication.php(173): require_once() #1 /var/www/html/warehouse/src/Application.php(47): Cake\Http\BaseApplication->bootstrap() #2 /var/www/html/warehouse/vendor/cakephp/cakephp/src/Http/Server.php(109): App\Application->bootstrap() #3 /var/www/html/warehouse/vendor/cakephp/cakephp/src/Http/Server.php(79): Cake\Http\Server->bootstrap() #4 /var/www/html/warehouse/webroot/index.php(44): Cake\Http\Server->run() #5 {main} thrown in /var/www/html/warehouse/config/bootstrap.php on line 119

I’m stumped. Any help would be appreciated.

Thanks,
Tom

Are you sure you are on CakePHP 4.4?
The Errortrap and ExceptionTrap classes have been added since that minor version but not before.
https://book.cakephp.org/4/en/appendices/4-4-migration-guide.html#errorhandler-consoleerrorhandler

Otherwise try updating composer and reinstalling the composer modules via

composer self-update
rm -rf vendor composer.lock
composer install

Kevin,

I think you may have identified the problem, but I won’t have time to rebuild and test over this weekend. The composer.lock file requires cakephp 4.4.10, but composer.json requires composer ^4.0. I see now that the cakephp version is 4.3.11, so That seems to be it.

I’ll let you know the result when I get a chance to rebuild this.

Thanks,
Tom

Hi Kevin,

Does this mean that I should change all requires of cakephp/cakephp to be at least 4.4.10, or are there other modules that need to get to that level as well? I’ve never had to deal with a composer issue until now.

Thanks,
Tom

If your lock file says it’s supposed to be 4.4.10, but the actual version installed is 4.3.11, then a simple composer install should resolve it.