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 the 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 'Foo_Bar' from 'app/code/Foo/Bar' has been already defined in 'vendor/foo/module-bar'.

You need to:

1. Make a backup of "app/code/Foo/Bar" folder

2. Remove "app/code/Foo/Bar".

3. Run commands

php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy