16

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
  • Did you try to remove var/generation var/cache and switch to developer mode? – Raphael at Digital Pianism Jul 12 '16 at 21:44
  • @RaphaelatDigitalPianism done both no luck – Klettseb Jul 13 '16 at 11:00
  • Did you install any third party modules before running Magento install ? – Aurélien FOUCRET Jul 18 '16 at 16:50
14

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.

  • Setting the web root outside of pub is, overall, not a very good idea. – siliconrockstar Mar 13 at 18:39
12

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.

  • Spot on. Disabling any modules before running setup:install or setup:upgrade is the problem – Stevie G Apr 10 '17 at 14:47
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

1

The steps I did were the following to get rid of this issue.

First I re-installed Magento completely new then I did this:

  • removed var/generation and var/cache

  • switched to developer mode to recompile

And suddenly it worked fine

  • 1
    recompile mode? where is that – Philipp Sander Feb 21 '17 at 10:07
  • If you switch to development mode then it recompiles – Klettseb Feb 21 '17 at 10:11
1

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.
0

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

protected by Community Nov 1 '16 at 12:24

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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