19

I have installed a fresh Magento 2.1 over the command line and always get the same fatal error when trying to access the frontend or backend.

Fatal error: Uncaught Error: Cannot instantiate interface Magento\Framework\App\Config\Scope\ReaderPoolInterface

Anyone experienced the same? I have found some resources but with no real help.

Update I have deleted var/di and var/generation and set it to developer mode

Fatal error: Uncaught Error: Cannot instantiate interface Magento\Framework\App\Config\Scope\ReaderPoolInterface in /shop/build/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:73 Stack trace: #0 
/shop/build/vendor/magento/framework/ObjectManager/ObjectManager.php(71): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\\Framewo...') #1 
/shop/build/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(126): Magento\Framework\ObjectManager\ObjectManager->get('Magento\\Framewo...') #2 
/shop/build/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(53): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgument(Array, 'Magento\\Framewo...', NULL, 'readerPool', 'Magento\\Framewo...') #3 
/shop/build/vendor/magento/framework/ObjectManager/Factory/Dynamic/Develo in /shop/build/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php on line 73
3
  • Did you try to remove var/generation var/cache and switch to developer mode? Jul 12, 2016 at 21:44
  • @RaphaelatDigitalPianism done both no luck
    – Klettseb
    Jul 13, 2016 at 11:00
  • Did you install any third party modules before running Magento install ? Jul 18, 2016 at 16:50

5 Answers 5

17

If you use nginx configuration from the official sample and running Magento in the default/developer mode this situation might happen with document root global value set as

root $MAGE_ROOT/pub;

The issue can be fixed by setting Magento root from pub directory to the root index.php

root $MAGE_ROOT;

In case of Apache the DocumentRoot value change might also fix the situation. Hope it will help.

1
  • Setting the web root outside of pub is, overall, not a very good idea. Mar 13, 2019 at 18:39
21

Make sure the PHP module intl is installed, clear var/generation (or generation/* if you're using Magento 2.2+) and var/cache, enable Magento modules (bin/magento module:enable --all), compile DI (bin/magento setup:di:compile), and then try again.

2
  • Spot on. Disabling any modules before running setup:install or setup:upgrade is the problem
    – tread
    Apr 10, 2017 at 14:47
  • Works for me, thank you! Dec 20, 2021 at 21:11
5

After you downloaded all the files/created the project through composer, you must setup the store. You can do this from the command line:

php bin/magento setup:store-config:set --help

Or going to: http://mystore.com/setup

2

I also have this kind of problem when trying to run Magento cli like magento list in the terminal. After several hours I tried the solutions but all the answers not work for me. it turns out that the di.xml file is lost.

Steps :

  • Copy all the missing file from here :

https://github.com/magento/magento2/tree/2.1/app/etc.

  • After that run the remove the cache : rm -rf var/*.
  • Now if you run magento list this will work again.
1

Had the same issue caused by changing the code without cleaning the cache first. I manually cleaned the cache it solved the issue.

sudo rm -rf var/cache
sudo rm -rf var/di
sudo rm -rf var/generation

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