bin/magento setup:di:compile give me this error Magento version 2.2.5

Source class "\Vendor\Module\Model\PostProductsInterface" for "\Vendor\Module\Model\PostProductsRepository" generation does not exist.
  • What version exact of magento – Mohamed El Mrabet Sep 7 '18 at 10:04
  • have you created the custom file in module? can you share that file PostProductsInterface. – kunj Sep 7 '18 at 10:45
  • 1
    Magento version 2.2.5 - this file does not exist \Vendor\Module\Model\PostProductsInterface.php – Altravista Sep 7 '18 at 11:42
  • Even I could not find PostProductsRepository and PostProductsRepository file in core magento 2. have you added any custom module? – kunj Sep 7 '18 at 12:01
  • it is under Vendor\Module\Api\Data\PostProductsInterface.php can it be? – Altravista Sep 7 '18 at 12:34

please check your project folder, if you don't see the class file maybe it's deleted or there is something wrong in your magento extension installation

if the class file exist, I think it could be 3rd extension that try inject that class. you can checking again 3rd extension that already install in your magento project

  • it is under Vendor\Module\Api\Data\PostProductsInterface.php can it be? – Altravista Sep 7 '18 at 12:34
  • yes it can be, if that's 3rd extension try to disable it, and do di:compile again to see if there is difference. and please notice for name class that you write, incorrect one letter will cause calling wrong class name and it will cause error class not found or does not exist. – mrfizh Sep 7 '18 at 13:30
  • if i disable the custom module no error on compile but i cannot find the error in my custom module – Altravista Sep 8 '18 at 6:50
  • is \Vendor\Module\Model\PostProductsInterface exist in your folder, and the path folder for PostProductsInterface.php is suitable based your description class ? – mrfizh Sep 8 '18 at 7:16
  • this file does not exist \Vendor\Module\Model\PostProductsInterface.php this is the only one with this name Vendor\Module\Api\Data\PostProductsInterface.php but this is interface not class interface PostProductsInterface – Altravista Sep 8 '18 at 7:29

remove this line from etc/di.xml solved

<preference for="Ea\Blog\Api\PostProductsRepositoryInterface" type="Ea\Blog\Model\PostProductsRepository"/>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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