Magento 2 Installation Fatal Error – Cannot instantiate interface

The question:

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 MagentoFrameworkAppConfigScopeReaderPoolInterface

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 MagentoFrameworkAppConfigScopeReaderPoolInterface in /shop/build/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:73 Stack trace: #0 
/shop/build/vendor/magento/framework/ObjectManager/ObjectManager.php(71): MagentoFrameworkObjectManagerFactoryDynamicDeveloper->create('Magento\Framewo...') #1 
/shop/build/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(126): MagentoFrameworkObjectManagerObjectManager->get('Magento\Framewo...') #2 
/shop/build/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(53): MagentoFrameworkObjectManagerFactoryAbstractFactory->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

The Solutions:

Below are the methods you can try. The first solution is probably the best. Try others if the first one doesn’t work. Senior developers aren’t just copying/pasting – they read the methods carefully & apply them wisely to each case.

Method 1

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.

Method 2

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.

Method 3

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

Method 4

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.

Method 5

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

Method 6

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


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Comment