module-blog
module-blog copied to clipboard
Fatal error while installing the module: Cannot instantiate interface Magefan\\Blog\\Api\\CategoryRepositoryInterface
Describe the bug
Fatal error while installing the Blog module:
"Fatal Error: 'Uncaught Error: Cannot instantiate interface Magefan\\Blog\\Api\\CategoryRepositoryInterface in \/home\/X\/domains\/X.nl\/application\/vendor\/magento\/framework\/ObjectManager\/Factory\/Dynamic\/Developer.php:50
Stack trace:
#0 \/home\/X\/domains\/X.nl\/application\/vendor\/magento\/framework\/ObjectManager\/ObjectManager.php(56):
Magento\\Framework\\ObjectManager\\Factory\\Dynamic\\Developer->create('Magefan\\\\Blog\\\\Ap...', Array)
#1 \/home\/X\/domains\/X.nl\/application\/vendor\/magefan\/module-blog\/Model\/ResourceModel\/Post\/Collection.php(68):
Magento\\Framework\\ObjectManager\\ObjectManager->create('Magefan\\\\Blog\\\\Ap...')
#2 \/home\/X\/domains\/X.nl\/application\/generated\/code\/Magefan\/Blog\/Model\/ResourceModel\/Post\/Collection\/Interceptor.php(14):
Magefan\\Blog\\Model\\ResourceModel\\Post\\Collection->__construct(Object(Magento\\Framework\\Data\\Collection\\EntityFactory), Object(Magento\\Framework\\Logger\\LoggerProxy), Object(Magento\\Framework\\Data\\Collection\\Db\\FetchStrategy\\Query), ' in '\/home\/X\/domains\/X.nl\/application\/vendor\/magento\/framework\/ObjectManager\/Factory\/Dynamic\/Developer.php' on line 50"
Preconditions:
- Magento Version: 2.4.2
- Module Version: 2.10.10.2
- PHP Version 7.3.33
To Reproduce Steps to reproduce the behavior:
- Run
composer require magefan/module-blog
- Run
php bin/magento setup:upgrade
Expected behavior No errors
Actual behavior Fatal error as shown above
Not sure if it's related to other 3rd party extensions, hopefully you guys can point me in the right direction of finding the cause.
@xgerhard ,
Please run the command
bin/magento setup:di:compile
Let us know if it helps.
Ah thanks, that should be run before setup:upgrade
? I'll try this tomorrow.
@xgerhard, usualy it runs after. But try to run before. For some reason, the implementing class of the interface was not assigned.
Unfortunately the same error. I'll see if I can get more info, on a different instance with same Magento version it did work fine.
Try to run this commands
rm -rf generated rm -rf var/cache #if has redis flush redis cache bin/magento setup:di:compile
Well... was about to try steps above, but tried the 'normal' way again first: 1. require.., 2. setup:upgrade , 3. di:compile. This time it ran without any errors, so it indeed might have been some cache related issue. Thanks for the suggestions!