PHP Fatal error: Uncaught OutOfBoundsException: Package "illuminate/support" is not installed in ...

I’m encountering an issue on a remote server with Acorn V5 when trying to run an acorn command.

wp acorn --path="www/wp"

PHP Fatal error:  Uncaught OutOfBoundsException: Package "illuminate/support" is not installed in /data/sites/web/xiwabe/app/master/releases/45/www/app/themes/xiwa/vendor/composer/InstalledVersions.php:246
Stack trace:
#0 /data/sites/web/xiwabe/app/master/releases/45/vendor/roots/acorn/src/Roots/Acorn/Application.php(133): Composer\InstalledVersions::getInstallPath()
#1 /data/sites/web/xiwabe/app/master/releases/45/vendor/roots/acorn/src/Roots/Acorn/Application.php(61): Roots\Acorn\Application->registerSupportHelpers()
#2 /data/sites/web/xiwabe/app/master/releases/45/vendor/roots/acorn/src/Roots/Acorn/Application.php(78): Roots\Acorn\Application->__construct()
#3 /data/sites/web/xiwabe/app/master/releases/45/www/app/themes/xiwa/functions.php(34): Roots\Acorn\Application::configure()
#4 /data/sites/web/xiwabe/app/master/releases/45/www/wp/wp-settings.php(672): include('...')
#5 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1375): require('...')
#6 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1294): WP_CLI\Runner->load_wordpress()
#7 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php(28): WP_CLI\Runner->start()
#8 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/bootstrap.php(83): WP_CLI\Bootstrap\LaunchRunner->process()
#9 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php(32): WP_CLI\bootstrap()
#10 phar:///usr/bin/wp/php/boot-phar.php(20): include('...')
#11 /usr/bin/wp(4): include('...')
#12 {main}
  thrown in /data/sites/web/xiwabe/app/master/releases/45/www/app/themes/xiwa/vendor/composer/InstalledVersions.php on line 246

I have a vendor/composer directory in my root directory (Bedrock), a vendor/composer directory in my theme (Sage) and some vendor/composer directories in plugins. It seems that on this remote server, Acorn is trying to load illuminate/support from my theme directory (InstalledVersions::getInstallPath('illuminate/support' in vendor/roots/acorn/src/Roots/Acorn/Application.php(133)).

When I remove composer.json from my theme, and move the theme dependencies (only autoloading) to my project root, Acorn is now looking for illuminate/support in a plugin (Fatal error: Uncaught OutOfBoundsException: Package "illuminate/support" is not installed in /data/sites/web/xiwabe/app/master/releases/46/www/app/plugins/acfml/vendor/composer/InstalledVersions.php:239)

The website is deployed with Deployer. I have no issues in my local machine. The website is functioning as it should, only the wp acorn cli commands are not working.
The remote server is running Apache, PHP 8.2.27

What does your theme’s composer.json look like?

What does your Bedrock composer.json look like?

Ok, had to dig quite deep to find the issue. In InstalledVersions::getInstalled(), composer checks if the getRegisteredLoaders method exists. In my local machine it exists, but not on the remote server, although it’s running the latest wp cli version (2.11.0).

When trying to run wp package update on the remote server, I got a dependency that is no longer available (wp-media/wp-rocket-cli dev-master). I replaced that dependency, ran wp package update, which also updated my .wp-cli/packages/vendor/composer package. The command is now running as it should.