Fatal Error in Magento

Magento is the first choice of every e-commerce developer. But every good thing comes with loopholes! A few days ago, one of my teammates got stuck with a fatal error in Magento 2. At first it seems like a Magento Extension Installation error or compatibility issue. However, composer update issues which we have faced is not the compatibility issue. If you don’t know about installing Magento Extensions then you can go for Milople’s Professional Magento Extension Installation Services.

The below Fatal Error while updating composer we have encountered:

Fatal error: Uncaught TypeError: Return value of Magento\InventoryComposerInstaller\Plugin::initModuleDeployment() must be an instance of Magento\InventoryComposerInstaller\void, none returned in /vendor/magento/inventory-composer-installer/src/Plugin.php:69

Stack trace:

  • [internal function]: Magento\InventoryComposerInstaller\Plugin->initModuleDeployment(Object(Composer\Script\Event))
  • phar:///opt/cpanel/composer/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php(176): call_user_func(Array, Object(Composer\Script\Event))
  • phar:///opt/cpanel/composer/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php(96): Composer\EventDispatcher\EventDispatcher->doDispatch(Object(Composer\Script\Event))
  • phar:///opt/cpanel/composer/bin/composer/src/Composer/Installer.php(204): Composer\EventDispatcher\EventDispatcher->dispatchScript('pre-update-cmd', true)
  • phar:///opt/cpanel/composer/bin/composer/src/Composer/Command/UpdateCommand.php(162): Composer\Inst in /vendor/magento/inventory-composer-installer/src/Plugin.php on line 69

Before proceeding to main solution, need to clarify few things:

  • If you run, composer ignoring requirements (--ignore-platform-reqs) , will not make any change in the troubleshooting composer in Magento 2.
  • In Magento core, some PHP functions are not compatible with all versions. To overcome Magento 2 PHP version compatibility issue, it's advisable to install 7.3

To solve Magento 2 composer fatal error, we took following step:

  • Remove it rm -rf vendor/  OR
  • Rename the vendor folder by mv vendor bkup_vendor

Run comoseer install and composer update after it Error should be removed by now.

That’s it!

To install Use below guide for Fresh Magento installation you can browse: https://devdocs.magento.com/guides/v2.3/install-gde/composer.html. Do not hesitate to reach out to us in case of any other Magento related issues. We’ll be more than happy to help you.