7

I have updated the version of magento from 2.3.4 => 2.3.7 but. Composer commands runs successfully with no error. But now when I try to run magento commands eg. s:up or compile it does not work and returns an error :

PHP Fatal error: Class Magento\Setup\Mvc\Bootstrap\InitParamListener contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (Laminas\ServiceManager\Factory\FactoryInterface::__invoke) in /htdocs/setup/src/Magento/Setup/Mvc/Bootstrap/InitParamListener.php on line 32

I tried composer update , composer install , removed vendor folder and then composer install but no luck.

Please help me to solve the issue I will be very thankful to you.

4 Answers 4

11

To fix this issue, copy the setup folder from magento 2.3.7 another project or download it from magento git repo: https://github.com/magento/magento2/tree/2.3.7/setup

It works for all others magento versions, just change 2.3.7 to your magento upgrade version. For example, you want to upgrade to magento 2.4.3, the setup folder can get in https://github.com/magento/magento2/tree/2.4.3/setup

7
  • 1
    do I just only need to replace the setup folder? Sep 6, 2021 at 19:00
  • how it will work? I have updated the version it is not a fresh installation I think. Please share your thoughts Sep 6, 2021 at 19:01
  • 1. Download or copy setup folder from magento core 2. Run this command to remove the current setup folder: rm -rf setup 3. Go to the project root folder, run this command to copy the new setup folder to the project root folder: cp -r PATH_TO/SETUP_FOLDER_JUST_DOWNLOADED . Done.
    – Tu Van
    Sep 7, 2021 at 8:37
  • I did Same but getting same problem, i renamed old setup folder and placed new setup folder from github link for magento 2.4.3. please help me Apr 7, 2022 at 8:06
  • @HassanRaza after that, you can run bin/magento setup:upgrade as normal
    – Tu Van
    Apr 7, 2022 at 8:32
2
rm -rf vendor/
composer update
1

The fact that you got this error suggests that you were using the setup directory from the older Magento version. In such case you could do what snez suggested above:

rm -rf vendor
composer install

But this would merge the setup directory from the newer version with the one from the older version, so it'd be good to remove it first:

rm -rf vendor
rm -rf setup
composer install

Technically you should do this with all files from the older version you happen to have:

rm -rf vendor
rm -rf setup
rm -rf lib
rm -rf dev
...
composer install

That is keeping in mind if you need any changes you made in case you keep them in VCS.

0

In that case, you'll need to figure out why exactly that file isn't being updated, what you could try is removing your entire vendor directory and run composer install, and after that check if the bin/magento file is now updated. If that still doesn't resolve it, check if the file vendor/magento/magento2-base/bin/magento is correct. If this one is correct and bin/magento is not correct, then you have a problem where that first file isn't being copied to the second file, which should normally happen during composer install.

1
  • Yes, I already followed the composer install , but no luck. how can I confirm if the file is correct and is it possible if I will copy the suggested files from another instance of magento? Aug 30, 2021 at 12:05

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.