If you have installed or updated Magento 2 extension and received the error message e.g.:
Module 'Company_Module' from 'app/code/Company/Module' has been already defined in 'vendor/company/module'.
this means that you have 2 versions of the extension:
1) in the folder app/code/Company/Module
2) in the folder vendor/company/module
In vendor folder Magento stores all components (extensions, themes, language packages) that have been installed using Composer.
As installing or updating extensions via Composer is preferred, you need to remove extension folder app/code/Company/Module (please don't forget about a backup before removal) and run installation commands.
If you get the error:
Module 'Magefan_Blog' from 'app/code/Magefan/Blog' has been already defined in 'vendor/magefan/module-blog'.
You need to:
1. Make a backup of "app/code/Magefan/Blog" folder
2. Remove "app/code/Magefan/Blog".
3. Run commands
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy