0

I upgraded a number of module but when I come to compile (bin/magento setup:di:compile) I get the error below. Anyone know how to fix it? Thank you Andy

Repositories code generation... 1/9 [===>------------------------] 11% < 1 sec 104.0 MiBCall to undefined function Composer\Autoload\includeFile()#0 /var/www/vhosts/mysite.co.uk/htdocs/public_html/vendor/composer/ClassLoader.php(578): include() #1 /var/www/vhosts/mysite.co.uk/htdocs/public_html/vendor/composer/ClassLoader.php(432): Composer\Autoload\ClassLoader::Composer\Autoload\{closure}() #2 [internal function]: Composer\Autoload\ClassLoader->loadClass() #3 [internal function]: spl_autoload_call() #4 /var/www/vhosts/mysite.co.uk/htdocs/public_html/setup/src/Magento/Setup/Module/Di/Code/Reader/ClassesScanner.php(134): class_exists() #5 /var/www/vhosts/mysite.co.uk/htdocs/public_html/setup/src/Magento/Setup/Module/Di/Code/Reader/ClassesScanner.php(117): Magento\Setup\Module\Di\Code\Reader\ClassesScanner->includeClass() #6 /var/www/vhosts/mysite.co.uk/htdocs/public_html/setup/src/Magento/Setup/Module/Di/Code/Reader/ClassesScanner.php(87): Magento\Setup\Module\Di\Code\Reader\ClassesScanner->extract() #7 /var/www/vhosts/mysite.co.uk/htdocs/public_html/setup/src/Magento/Setup/Module/Di/App/Task/Operation/RepositoryGenerator.php(61): Magento\Setup\Module\Di\Code\Reader\ClassesScanner->getList() #8 /var/www/vhosts/mysite.co.uk/htdocs/public_html/setup/src/Magento/Setup/Module/Di/App/Task/Manager.php(56): Magento\Setup\Module\Di\App\Task\Operation\RepositoryGenerator->doOperation() #9 /var/www/vhosts/mysite.co.uk/htdocs/public_html/setup/src/Magento/Setup/Console/Command/DiCompileCommand.php(216): Magento\Setup\Module\Di\App\Task\Manager->process() #10 /var/www/vhosts/mysite.co.uk/htdocs/public_html/vendor/symfony/console/Command/Command.php(255): Magento\Setup\Console\Command\DiCompileCommand->execute() #11 /var/www/vhosts/mysite.co.uk/htdocs/public_html/vendor/symfony/console/Application.php(1021): Symfony\Component\Console\Command\Command->run() #12 /var/www/vhosts/mysite.co.uk/htdocs/public_html/vendor/symfony/console/Application.php(275): Symfony\Component\Console\Application->doRunCommand() #13 /var/www/vhosts/mysite.co.uk/htdocs/public_html/vendor/magento/framework/Console/Cli.php(115): Symfony\Component\Console\Application->doRun() #14 /var/www/vhosts/mysite.co.uk/htdocs/public_html/vendor/symfony/console/Application.php(149): Magento\Framework\Console\Cli->doRun() #15 /var/www/vhosts/mysite.co.uk/htdocs/public_html/bin/magento(23): Symfony\Component\Console\Application->run() #16 {main} You have new mail in /var/spool/mail/mysite` -bash-4.2$ 

Still struggling with this.

I found some advice to find which class is causing issues by adding echo "Class: ".$path."\n to the /setup/src/Magento/Setup/Module/Di/Code/Reader/ClassesScanner.php file.

Now I'm getting the below when running setup:di:compile

syntax error, unexpected '$realPath' (T_VARIABLE), expecting ';' or ','#0 /var/www/vhosts/mysite.co.uk/public_html/vendor/composer/ClassLoader.php(432): Composer\Autoload\ClassLoader::Composer\Autoload{closure}() #1 [internal function]: Composer\Autoload\ClassLoader->loadClass() #2 [internal function]: spl_autoload_call() #3 /var/www/vhosts/mysite.co.uk/public_html/vendor/magento/framework/Code/Reader/ClassReader.php(71): ReflectionClass->__construct() #4 /var/www/vhosts/mysite.co.uk/public_html/vendor/magento/framework/Code/Reader/ClassReader.php(36): Magento\Framework\Code\Reader\ClassReader->getParameterClass() #5 /var/www/vhosts/mysite.co.uk/public_html/vendor/magento/framework/ObjectManager/Definition/Runtime.php(54): Magento\Framework\Code\Reader\ClassReader->getConstructor() #6 /var/www/vhosts/mysite.co.uk/public_html/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(48): Magento\Framework\ObjectManager\Definition\Runtime->getParameters() #7 /var/www/vhosts/mysite.co.uk/public_html/vendor/magento/framework/ObjectManager/ObjectManager.php(56): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create() #8 /var/www/vhosts/mysite.co.uk/public_html/setup/src/Magento/Setup/Module/Di/App/Task/OperationFactory.php(109): Magento\Framework\ObjectManager\ObjectManager->create() #9 /var/www/vhosts/mysite.co.uk/public_html/setup/src/Magento/Setup/Module/Di/App/Task/Manager.php(38): Magento\Setup\Module\Di\App\Task\OperationFactory->create() #10 /var/www/vhosts/mysite.co.uk/public_html/setup/src/Magento/Setup/Console/Command/DiCompileCommand.php(189): Magento\Setup\Module\Di\App\Task\Manager->addOperation() #11 /var/www/vhosts/mysite.co.uk/public_html/vendor/symfony/console/Command/Command.php(255): Magento\Setup\Console\Command\DiCompileCommand->execute() #12 /var/www/vhosts/mysite.co.uk/public_html/vendor/symfony/console/Application.php(1021): Symfony\Component\Console\Command\Command->run() #13 /var/www/vhosts/mysite.co.uk/public_html/vendor/symfony/console/Application.php(275): Symfony\Component\Console\Application->doRunCommand() #14 /var/www/vhosts/mysite.co.uk/public_html/vendor/magento/framework/Console/Cli.php(115): Symfony\Component\Console\Application->doRun() #15 /var/www/vhosts/mysite.co.uk/public_html/vendor/symfony/console/Application.php(149): Magento\Framework\Console\Cli->doRun() #16 /var/www/vhosts/mysite.co.uk/public_html/bin/magento(23): Symfony\Component\Console\Application->run()

Line 432 of the /var/www/vhosts/mysite.co.uk/public_html/vendor/composer/ClassLoader.php(432): Is (self::$includeFile)($file);

Tu Van I did try removing the vendor folder but this didn't work either. Hope someone can advise. Andy

3
  • Hey Andy, try to remove vendor directory and run composer install. Commented Jan 31, 2023 at 11:38
  • disable your custom or third party modules one by one and try compile Commented Feb 1, 2023 at 5:55
  • Thanks guys - Tu what is the exact command for composer? Thanks Commented Feb 1, 2023 at 16:33

1 Answer 1

0

There is a syntax error either correct it by hand or as suggested delete the whole vendor folder and reinstall it. Be careful when editing magento core files. Here I list some commands that may be useful to you.

If you can manually fix the error after run the command, composer dump autoload php bin/magento setup:di:compile .

Otherwise use the command rm -rf vendor composer install

3
  • Hi Gennaro Before I run the rm -rf vendor composer install How would I manually fix the syntax error? The error code suggests the error is at Line 432 of the /var/www/vhosts/mysite.co.uk/public_html/vendor/composer/ClassLoader.php(432): Which is (self::$includeFile)($file); but this line does contain the ; Thank you Commented Mar 1, 2023 at 14:50
  • I copied the ClassLoader.php from a working dev site to the effected site and can now run the command bin/magento setup:di:compile There were differences in the other ClassLoader.php file. I just hope this won't have any negative effect later on. Commented Mar 1, 2023 at 16:45
  • Don't worry, I always suggest you copy the files either from the official version of magento on github or I suggest you download a virgin open source version in zip format so you can always go and check the differences. Commented Mar 7, 2023 at 10:08

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.