Magento – Fatal error: Cannot instantiate interface

designmagento2

My magento store is throwing this error:

Fatal error: Cannot instantiate interface Magento\Framework\View\Design\Theme\ResolverInterface in /Library/WebServer/Documents/magento/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php on line 73

I don't know why it started to appear. I made no new module installation. The store was working fine.

I've check file permissions and I see no issue there. Also delete the /var/ dir and, I think, all folders/files where created.

[EDIT] The preference is defined vendor/magento/magento2-base/app/etc/di.xml

<preference for="Magento\Framework\View\Design\Theme\ResolverInterface" type="Magento\Theme\Model\Theme\Resolver" /> 

Best Answer

If you use redis, run:


redis-cli flushall


If you also use an environment like ansible (lxc - server), you'll need to do that command in container. Plus I did the following:

  • Clear var/generation (or generated/* in newer versions)
  • Clear var/cache
  • Check if the module generating the error is enabled and enable it (bin/magento module:enagle Some_Module) or Enable all Magento modules: bin/magento module:enable --all
  • Compile DI bin/magento setup:di:compile
Related Topic