Skip to content

Fatal error: Cannot instantiate interface #2502

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bvboas opened this issue Nov 24, 2015 · 13 comments
Closed

Fatal error: Cannot instantiate interface #2502

bvboas opened this issue Nov 24, 2015 · 13 comments

Comments

@bvboas
Copy link

bvboas commented Nov 24, 2015

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 deleted /var/ dir and folders/files where created.

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" /> 
@mazhalai
Copy link
Contributor

@bvboas can you please give more details about your environment, and how to reproduce this error? Navigate to front end or backend after installation?

@bvboas
Copy link
Author

bvboas commented Nov 24, 2015

OS: MAC OS X 10.9
PHP 5.6.11
Apache/2.2.29 (Unix)

I don't have any third-party extension enabled.

I just have to visit any page, frontend or backend, for the error to show.

@mazhalai
Copy link
Contributor

@bvboas what mode are you in?

@bvboas
Copy link
Author

bvboas commented Nov 25, 2015

@mazhalai The .htaccess directive

SetEnv

is commented. So I assume is in 'default'

Switched to developer and production, but the error persists.

@mazhalai
Copy link
Contributor

@bvboas can you check apache or php logs to see if there is any stack trace?

@alankent
Copy link

You might check the di.xml file to see if you added a comment and failed to close it correctly, or something silly like that to cause the <preference...> element to be omitted. The fact that it worked and now does not, leads me to the suspicion "you accidentally broke it". I am trying to think of how you could have done this - an XML comment is one way the preference was not loaded.

@bvboas
Copy link
Author

bvboas commented Nov 25, 2015

@alankent You were right.

I've just switched to phpStorm, and since there are no warnings about saving changes, for some reason

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

became

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

Sorry about this.

@mazhalai
Copy link
Contributor

@bvboas thank you for your update. Closing this issue. Please feel free to open a new one in case of any issues.

@alankent
Copy link

"You were right." SCORE!!!

Ahem. Glad to be of help.

@rexha5minds
Copy link

i dont understand, how you resolve this problem, can you please explain it again, because i have the same error and search for a solution my last 5 hours

@bvboas
Copy link
Author

bvboas commented Jan 5, 2016

@rexha5minds it was an issue with the di.xml file. Make sure you haven't made any changes.

@tdgroot
Copy link
Member

tdgroot commented Jul 13, 2016

I have had this issue as well, having the deploy mode set to developer. Turns out I got this error because I used --no-dev when installing the application.

@tristanisginger
Copy link

As @alankent says "Check your di.xml"

I didn't realise you need to add it as a preference if you instantiate it. Documentation

magento-engcom-team pushed a commit that referenced this issue May 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants