After firing this command in command line php bin/magento setup:di:compile I am getting this error:

Cannot declare interface Magento\Framework\App\DeploymentConfig\Writer\FormatterInterface, because the name is already in use in /var/www/html/vendor/magento/framework/App/DeploymentConfig/Writer/FormatterInterface.php on line 9

Can you have a best solution for me?


  • Is there any custom extension? – Khoa TruongDinh Dec 24 '16 at 3:25
  • just try with remove var folder from root and run again. – Rakesh Jesadiya Dec 24 '16 at 5:17

Please try to remove all the directories inside var/generation folder and then run following command :

php bin/magento cache:flush

After that run your command you will be succeed.

| improve this answer | |
  • Thank for your idea! – Peter Jan 20 '17 at 3:29
  • Most welcome :) – Sneha Panchal Jan 9 '19 at 11:09

Make sure that in your interface and also the interface that Magento says you are re-declaring, that you have declared the namespace at the top of both classes. This has happened to me before and that is usually the reason.

| improve this answer | |

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.