Magento – An abstract factory could not create an instance of magentoframeworkappdeploymentconfig(alias: Magento\Framework\App\DeploymentConfig

magento2magento2.3.5-p1

I am upgrading Magento 2.3.3 to Magento ver 2.3.5-p1 through the composer. After composer install and composer update when I try to run bin/magento setup: upgrade I am getting

"An abstract factory could not create an instance of magentoframeworkappdeploymentconfig(alias: Magento\Framework\App\DeploymentConfig)."

error. Please suggest on this.
PHP ver 7.3.18

Best Answer

"Unable to run bin/magento In some cases after running the composer upgrade you may find yourself unable to run bin/magento on the command line, and instead get the following error

An abstract factory could not create an instance of magentoframeworkappdeploymentconfig(alias: Magento\Framework\App\DeploymentConfig).

This is due to the setup folder not being updated, which means it still has references to the Zend Framework packages rather than the new Laminas ones.

The way to fix this is to use composer to create a new Magento 2 project and then copy the setup folder from there in to the code base. Make sure any changes that you have made to the directory are applied and then the command should work"

Source


In my case I just copied the setup folder of another working magento installation over mine. I also noticed that all modules were disabled. So I had to enable them

php bin/magento module:enable --all && php bin/magento setup:upgrade && php bin/magento setup:di:compile && php bin/magento setup:static-content:deploy de_DE && php bin/magento setup:static-content:deploy