4

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?

3
  • try with sudo php bin/magento setup:upgrade Apr 1, 2016 at 11:12
  • If your creating any module then please share your code as there will be problem in your code you have to define it in public function __construct() to use
    – Arunendra
    Apr 1, 2016 at 11:16
  • i have removed the custom plugin and tried upgrade but still its showing same error
    – Aswanth
    Apr 1, 2016 at 11:18

3 Answers 3

2

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
6
  • 1
    The 'php bin/magento setup:di:compile' step is not mandatory, though. Magento can also generate files it needs on the fly, so you don't have to wait for the entire di to be compiled each time you change some dependencies. Apr 1, 2016 at 11:19
  • i have run the php bin/magento setup:di:compile but same error is repeating
    – Aswanth
    Apr 1, 2016 at 11:22
  • Did you update the magento version? Maybe your framework module is corrupt?
    – tecjam
    Apr 1, 2016 at 11:24
  • current version is 2.0.2
    – Aswanth
    Apr 1, 2016 at 11:34
  • after some googling i have deleted entire var folder and some how able to run setup:upgrade and setup:di:compile but var/generate folder is missing
    – Aswanth
    Apr 1, 2016 at 11:44
0

Disable your custom modules and find out from which module it is coming.

Debug the configuration files of that module for the error.

As this is an error in xml file.

1
  • previously i have added a plugin and then i have removed that so it shouldn't be affecting right?. right now there is no extra plugin, only magento default modules
    – Aswanth
    Apr 1, 2016 at 11:24
0

I ran into this same issue. After performing a compile, any call to the Magento command line would fail as you describe. In my case it was because I was attempting to use PHP 7.0.5

The Magento system requirements state: "There is a known PHP issue that affects our code compiler when using PHP 7.0.5. We recommend you not use PHP 7.0.5." http://devdocs.magento.com/guides/v2.0/install-gde/system-requirements.html

Hope this helps!

2
  • UPDATE: It appears that this bug was fixed in PHP 7.0.6, however the Magento site does not yet list 7.0.6 as "supported". I am currently running under 7.0.6 in my development environment and will report back if I run into any issues.
    – Dan Buchal
    May 9, 2016 at 17:17
  • UPDATE #2: It looks like Magento is also addressing this on their end, and should have a fix in the next release: github.com/magento/magento2/issues/3963
    – Dan Buchal
    May 10, 2016 at 14:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.