Magento – setup:upgrade is throwing error

fatal errormagento2upgrade

When I try to do a setup upgrade using the below command, it throws a PHP Fatal Error:

$ sudo bin/magento setup:upgrade
PHP Fatal error:  Uncaught TypeError: Argument 1 passed to Magento\Framework\Config\Scope::__construct() must be an instance of Magento\Framework\App\AreaList, instance of Magento\Framework\ObjectManager\ObjectManager given, called in /var/www/magento2/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 97 and defined in /var/www/magento2/vendor/magento/framework/Config/Scope.php:37
Stack trace:
#0 /var/www/magento2/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(97): Magento\Framework\Config\Scope->__construct(Object(Magento\Framework\ObjectManager\ObjectManager))
#1 /var/www/magento2/vendor/magento/framework/ObjectManager/Factory/Compiled.php(88): Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject('Magento\\Framewo...', Array)
#2 /var/www/magento2/vendor/magento/framework/ObjectManager/ObjectManager.php(71): Magento\Framework\ObjectManager\Factory\Compiled->create('Magento\\Framewo...')
#3 /var/www/magento2/vendor/magento/framework/App/ObjectManager/Environment/Com in /var/www/magento2/vendor/magento/framework/Config/Scope.php on line 37

When I launch the site in browser it's showing 500 error, and the same error message is shown on the apache error log.

Is there any way to reset Magento to fresh install state without any extra modules?

Best Answer

Usually you receive this error when you have changed some dependency injections and your var/di/ is out of date.

I would recommend deleting the var/di folder and then run:

php bin/magento setup:di:compile
Related Topic