Hello,
I am using composer 1.10
Magento 2.4
PHP 7.4
when trying to require or to update I get
PHP Fatal error: Uncaught TypeError: Return value of Magento\InventoryComposerInstaller\Plugin::initModuleDeployment() must be an instance of Magento\InventoryComposerInstaller\void, none returned in /var/www/vhosts/meineapo.at/m24.meineapo.at/vendor/magento/inventory-composer-installer/src/Plugin.php:69
Stack trace:
#0 [internal function]: Magento\InventoryComposerInstaller\Plugin->initModuleDeployment(Object(Composer\Script\Event))
#1 phar:///opt/psa/var/modules/composer/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php(164): call_user_func(Array, Object(Composer\Script\Event))
#2 phar:///opt/psa/var/modules/composer/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php(96): Composer\EventDispatcher\EventDispatcher->doDispatch(Object(Composer\Script\Event))
#3 phar:///opt/psa/var/modules/composer/composer.phar/src/Composer/Installer.php(208): Composer\EventDispatcher\EventDispatcher->dispatchScript('pre-update-cmd', true)
#4 phar:///opt/psa/var/modules/composer/composer.phar/src/Composer/Command/Update in /var/www/vhosts/meineapo.at/m24.meineapo.at/vendor/magento/inventory-composer-installer/src/Plugin.php on line 69
Fatal error: Uncaught TypeError: Return value of Magento\InventoryComposerInstaller\Plugin::initModuleDeployment() must be an instance of Magento\InventoryComposerInstaller\void, none returned in /var/www/vhosts/meineapo.at/m24.meineapo.at/vendor/magento/inventory-composer-installer/src/Plugin.php:69
Stack trace:
#0 [internal function]: Magento\InventoryComposerInstaller\Plugin->initModuleDeployment(Object(Composer\Script\Event))
#1 phar:///opt/psa/var/modules/composer/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php(164): call_user_func(Array, Object(Composer\Script\Event))
#2 phar:///opt/psa/var/modules/composer/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php(96): Composer\EventDispatcher\EventDispatcher->doDispatch(Object(Composer\Script\Event))
#3 phar:///opt/psa/var/modules/composer/composer.phar/src/Composer/Installer.php(208): Composer\EventDispatcher\EventDispatcher->dispatchScript('pre-update-cmd', true)
#4 phar:///opt/psa/var/modules/composer/composer.phar/src/Composer/Command/Update in /var/www/vhosts/meineapo.at/m24.meineapo.at/vendor/magento/inventory-composer-installer/src/Plugin.php on line 69
Any idea?
Regards,
Gunther
I was also facing such kind of issues yesterday and it was related to composer.lock file issue foe me.
You can follow below steps:
It can be an issue of PHP versions. I will recommend you to check your HTTP requests and Command line PHP version.
OR
Clear composer cache and the update composer.
composer clearcache
composer update
OR
Remove the vendor directory and give another try to composer install
OR
You can try by running below command:
Composer self-update
PS: Keep backup before running any commands. Apart from that Magento 2.4 requires latest stable composer version as well. Thanks
Compser is newest version, PHP is 2.4.
Which directory should I delete?
Regards,
Gunther
@meineapo Can you match the php version with the cli version, if both are same or not.
for this just run php -v on cli and check the version and create info.php file with the below code and run this file on browser and match the version there.
<?php echo phpinfo();
Thanks
Both 7.4
Regards,
Gunther
OK, solution found: composer does not use php version from path...
Hi
May be i am late to reply this but hope below answer can help.
I had same issue i have fixed it by remove "void" from "endor/magento/inventory-composer-installer/src/Plugin.php" file. Assign return type to method is not compatible to your php version so either you can use " use void;" declaration at top or remove ": void" from method return type.