magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.55k stars 9.32k forks source link

php bin/magento setup:di:compile Causing MiBsyntax error, unexpected ')', expecting variable (T_VARIABLE)#0 #38164

Closed jtannous-itxi closed 11 months ago

jtannous-itxi commented 1 year ago

Preconditions and environment

Steps to reproduce

Trying to install a new extension: https://help.crisp.chat/en/article/how-to-install-crisp-helpdesk-and-live-chat-on-adobe-commerce-ka7n7j/#1-how-to-install-crisp-on-adobe-commerce-magento-using-composer

# Update your compose.json file
composer require crisp-chat/chatbox-and-helpdesk:1.0.0

# Enable the Crisp module:
bin/magento module:enable Crisp_Crisp

# Register the extension and update the database schema & data
bin/magento setup:upgrade

# Generate the new code
bin/magento setup:di:compile

# Deploy static files
bin/magento setup:static-content:deploy

# Clean the cache
bin/magento cache:clean

When I reach the command: bin/magento setup:di:compile , I get the following error:

Compilation was started.
Repositories code generation... 1/9 [===>------------------------]  11% 6 secs 142.0 MiBsyntax error, unexpected ')', expecting variable (T_VARIABLE)#0 C:\xampp\htdocs\librairie-antoine\vendor\composer\ClassLoader.php(427): Composer\Autoload\{closure}('C:\\xampp\\htdocs...')
#1 [internal function]: Composer\Autoload\ClassLoader->loadClass('Knowband\\Scratc...')
#2 [internal function]: spl_autoload_call('Knowband\\Scratc...')
#3 C:\xampp\htdocs\librairie-antoine\setup\src\Magento\Setup\Module\Di\Code\Reader\ClassesScanner.php(134): class_exists('Knowband\\Scratc...')
#4 C:\xampp\htdocs\librairie-antoine\setup\src\Magento\Setup\Module\Di\Code\Reader\ClassesScanner.php(117): Magento\Setup\Module\Di\Code\Reader\ClassesScanner->includeClass('Knowband\\Scratc...', 'C:\\xampp\\htdocs...')
#5 C:\xampp\htdocs\librairie-antoine\setup\src\Magento\Setup\Module\Di\Code\Reader\ClassesScanner.php(87): Magento\Setup\Module\Di\Code\Reader\ClassesScanner->extract(Object(RecursiveIteratorIterator))
#6 C:\xampp\htdocs\librairie-antoine\setup\src\Magento\Setup\Module\Di\App\Task\Operation\RepositoryGenerator.php(61): Magento\Setup\Module\Di\Code\Reader\ClassesScanner->getList('C:/xampp/htdocs...')
#7 C:\xampp\htdocs\librairie-antoine\setup\src\Magento\Setup\Module\Di\App\Task\Manager.php(56): Magento\Setup\Module\Di\App\Task\Operation\RepositoryGenerator->doOperation()
#8 C:\xampp\htdocs\librairie-antoine\setup\src\Magento\Setup\Console\Command\DiCompileCommand.php(216): Magento\Setup\Module\Di\App\Task\Manager->process(Object(Closure), Object(Closure))
#9 C:\xampp\htdocs\librairie-antoine\vendor\symfony\console\Command\Command.php(255): Magento\Setup\Console\Command\DiCompileCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 C:\xampp\htdocs\librairie-antoine\vendor\symfony\console\Application.php(1021): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 C:\xampp\htdocs\librairie-antoine\vendor\symfony\console\Application.php(275): Symfony\Component\Console\Application->doRunCommand(Object(Magento\Setup\Console\Command\DiCompileCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 C:\xampp\htdocs\librairie-antoine\vendor\magento\framework\Console\Cli.php(116): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 C:\xampp\htdocs\librairie-antoine\vendor\symfony\console\Application.php(149): Magento\Framework\Console\Cli->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 C:\xampp\htdocs\librairie-antoine\bin\magento(23): Symfony\Component\Console\Application->run()
#15 {main}

When I uninstall the module, and remove from vendor folder, the same error shows for an other module as well, so I think the issue is not with the module specified in the error.

Expected result

Compilation should be successful and we should see Crisp.chat extension available in Magento admin.

Actual result

Compilation was started.
Repositories code generation... 1/9 [===>------------------------]  11% 6 secs 142.0 MiBsyntax error, unexpected ')', expecting variable (T_VARIABLE)#0 C:\xampp\htdocs\librairie-antoine\vendor\composer\ClassLoader.php(427): Composer\Autoload\{closure}('C:\\xampp\\htdocs...')
#1 [internal function]: Composer\Autoload\ClassLoader->loadClass('Knowband\\Scratc...')
#2 [internal function]: spl_autoload_call('Knowband\\Scratc...')
#3 C:\xampp\htdocs\librairie-antoine\setup\src\Magento\Setup\Module\Di\Code\Reader\ClassesScanner.php(134): class_exists('Knowband\\Scratc...')
#4 C:\xampp\htdocs\librairie-antoine\setup\src\Magento\Setup\Module\Di\Code\Reader\ClassesScanner.php(117): Magento\Setup\Module\Di\Code\Reader\ClassesScanner->includeClass('Knowband\\Scratc...', 'C:\\xampp\\htdocs...')
#5 C:\xampp\htdocs\librairie-antoine\setup\src\Magento\Setup\Module\Di\Code\Reader\ClassesScanner.php(87): Magento\Setup\Module\Di\Code\Reader\ClassesScanner->extract(Object(RecursiveIteratorIterator))
#6 C:\xampp\htdocs\librairie-antoine\setup\src\Magento\Setup\Module\Di\App\Task\Operation\RepositoryGenerator.php(61): Magento\Setup\Module\Di\Code\Reader\ClassesScanner->getList('C:/xampp/htdocs...')
#7 C:\xampp\htdocs\librairie-antoine\setup\src\Magento\Setup\Module\Di\App\Task\Manager.php(56): Magento\Setup\Module\Di\App\Task\Operation\RepositoryGenerator->doOperation()
#8 C:\xampp\htdocs\librairie-antoine\setup\src\Magento\Setup\Console\Command\DiCompileCommand.php(216): Magento\Setup\Module\Di\App\Task\Manager->process(Object(Closure), Object(Closure))
#9 C:\xampp\htdocs\librairie-antoine\vendor\symfony\console\Command\Command.php(255): Magento\Setup\Console\Command\DiCompileCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 C:\xampp\htdocs\librairie-antoine\vendor\symfony\console\Application.php(1021): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 C:\xampp\htdocs\librairie-antoine\vendor\symfony\console\Application.php(275): Symfony\Component\Console\Application->doRunCommand(Object(Magento\Setup\Console\Command\DiCompileCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 C:\xampp\htdocs\librairie-antoine\vendor\magento\framework\Console\Cli.php(116): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 C:\xampp\htdocs\librairie-antoine\vendor\symfony\console\Application.php(149): Magento\Framework\Console\Cli->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 C:\xampp\htdocs\librairie-antoine\bin\magento(23): Symfony\Component\Console\Application->run()
#15 {main}

Additional information

Please keep in mind this is a local dev environment, running on XAMPP.

Release note

No response

Triage and priority

m2-assistant[bot] commented 1 year ago

Hi @jtannous-itxi. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

ananth-iyer commented 1 year ago

@magento I am working on this

ananth-iyer commented 1 year ago

Hi @jtannous-itxi I have installed the plugin in Magento 2.3.3-p1 to 2.4.6-p3 and found no errors with setup:di:compile

I am running Magento 2 on Ubuntu.

I think it could be related to Windows OS running PHP. Some features do not work properly. Can you try to install Ubuntu WSL on Windows and try to install this plugin?

Magento also recommends to use Linux OS like Ubuntu, Cent OS.

m2-assistant[bot] commented 12 months ago

Hi @engcom-Bravo. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

engcom-Bravo commented 12 months ago

@ananth-iyer Thanks for your contribution & collaboration over here.

HI @jtannous-itxi,

Thank you for reporting and collaboration.

We have verified and able to install the plugin successfully found no errors with setup:di:compile.

We have verified the issue in Mac OS.

Could you please check system requirements https://experienceleague.adobe.com/docs/commerce-operations/installation-guide/system-requirements.html

Thanks.

hostep commented 11 months ago

@jtannous-itxi: since Knowband\\Scratc... is mentioned in your stacktrace a couple of times, I would expect the problem to be in one of their modules, maybe try uninstalling or updating those?

engcom-Bravo commented 11 months ago

@hostep Thanks for your contribution & collaboration over here.

@jtannous-itxi,

Please refer this https://github.com/magento/magento2/issues/38164#issuecomment-1823564892 and please let us know if you are still facing any issue.

Thanks.

jtannous-itxi commented 11 months ago

Hello, Thank you for your assistance on this issue. Indeed the issue was caused by Knowband/Scratch module, after uninstalling it, no compilation errors occurred.

engcom-Bravo commented 11 months ago

Hi @jtannous-itxi,

Thanks for your update.

As per this comment https://github.com/magento/magento2/issues/38164#issuecomment-1823871521 We are closing this issue.

Thanks.