1

I am getting this error when compiling my updated MCE 2.4.3 install. I have php 7.4.27 in magento and outside in the shell. I have read that this might be connected to wrong version of php but i checked everywhere and I am on 7.4.27 which should be fine. What am I missing?

1/9 [===>------------------------]  11% < 1 sec 125.0 MiBsyntax error, unexpected '=', expecting variable (T_VARIABLE)#0 /var/www/html/vendor/composer/ClassLoader.php(428): Composer\Autoload\includeFile()
#1 [internal function]: Composer\Autoload\ClassLoader->loadClass()
#2 [internal function]: spl_autoload_call()
#3/var/www/html/setup/src/Magento/Setup/Module/Di/Code/Reader/ClassesScanner.php(134): class_exists()
#4 /var/www/html/setup/src/Magento/Setup/Module/Di/Code/Reader/ClassesScanner.php(117): Magento\Setup\Module\Di\Code\Reader\ClassesScanner->includeClass()
#5 /var/www/html/setup/src/Magento/Setup/Module/Di/Code/Reader/ClassesScanner.php(87): Magento\Setup\Module\Di\Code\Reader\ClassesScanner->extract()
#6 /var/www/html/setup/src/Magento/Setup/Module/Di/App/Task/Operation/RepositoryGenerator.php(61): Magento\Setup\Module\Di\Code\Reader\ClassesScanner->getList()
#7 /var/www/html/setup/src/Magento/Setup/Module/Di/App/Task/Manager.php(56): Magento\Setup\Module\Di\App\Task\Operation\RepositoryGenerator->doOperation()
#8 /var/www/html/setup/src/Magento/Setup/Console/Command/DiCompileCommand.php(216): Magento\Setup\Module\Di\App\Task\Manager->process()
#9 /var/www/html/vendor/symfony/console/Command/Command.php(255): Magento\Setup\Console\Command\DiCompileCommand->execute()
#10 /var/www/html/vendor/symfony/console/Application.php(1009): Symfony\Component\Console\Command\Command->run()
#11 /var/www/html/vendor/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand()
#12 /var/www/html/vendor/magento/framework/Console/Cli.php(115): Symfony\Component\Console\Application->doRun()
#13 /var/www/html/vendor/symfony/console/Application.php(149): Magento\Framework\Console\Cli->doRun()
#14 /var/www/html/bin/magento(23): Symfony\Component\Console\Application->run()

4 Answers 4

2

Try with run command using php version like:

/usr/bin/php8.1 bin/magento setup:di: compile

Instead of php bin/magento setup:di:compile

1

I think you don't have all the essential files of your installation because your git might not have them or the Composer load optimization is causing it, try to run these commands below to get the updated composer packages again to your setup and root folders.

rm -rf setup/vendor/* vendor/* ;
cd setup; composer update -vvv; cd - ;
composer update -vvv;

If it doesn't work, try to get all files from your server and update your local environment with them with a zip folder. Having it working locally in the current version before updating it is a good idea too.

1
  • thank you, it helped me fixed some other things, but in this case the problem was actually in the syntax of one of the components Commented Jan 20, 2022 at 16:27
0

In this case it actually was a syntax error in one of the files

app/code/Mageplaza/LayeredNavigation/Model/Layer/Filter/Price.php on line 156

isLast needs to be $isLast

0

We get this error, When we have syntax error in custom magento command class.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.