cancel
Showing results for 
Search instead for 
Did you mean: 

composer problem

composer problem

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

8 REPLIES 8

Re: composer problem

@meineapo It seems like that you need to upgrade your composer version. 

For upgrade composer. You can follow this link

Hope, It maybe helpful for you.

 

Thanks

Re: composer problem

@meineapo 

 

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

Manish Mittal
https://www.manishmittal.com/

Re: composer problem

Compser is newest version, PHP is 2.4.

Which directory should I delete?

 

Regards,
Gunther

Re: composer problem

@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

Re: composer problem

Both 7.4

 

Regards,
Gunther

Re: composer problem

OK, solution found: composer does not use php version from path...

Re: composer problem

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.

Re: composer problem

1. Composer Dependency Management Problem (in PHP):
If you're referring to Composer in the context of PHP, it is a tool used to manage project dependencies. A common problem with Composer occurs when dependencies conflict or when there's an issue with the composer.json file or the composer.lock file.

Common Composer Problems and Solutions:
Version conflicts: This can happen when different packages require different versions of the same dependency. To solve this:

Check the conflict message that Composer provides.
Adjust the version constraints in composer.json for the conflicting packages.
Run composer update to attempt resolving conflicts.
Outdated Composer or dependencies: Running an outdated version of Composer or dependencies can lead to issues.

Run composer self-update to ensure you're using the latest version of Composer.
Run composer update to update the dependencies as well.
Missing or corrupted composer.lock file: If the lock file is corrupted or missing, it can lead to unpredictable behavior in your project.

Regenerate it by running composer install or deleting composer.lock and running composer update.
Memory limits: Sometimes, Composer might run into memory issues during installation.

Increase the PHP memory limit by running php -d memory_limit=-1 /path/to/composer install.
Example of a Composer-related Problem and Solution:
Problem: You run composer install, and you see an error about a missing dependency or a version mismatch.
Solution: Check the specific error message, then either update the composer.json file to accommodate the required version or manually update the package with composer update <package-name>