I’ve updated the modules via composer and I got the error Amasty/Base has been already defined.

I’ve updated the modules via composer and I got the error Amasty/Base has been already defined.

For Amasty modules, there are two possible ways of installation/update: via composer and via a direct file upload. Depending on the initial installation method, the module files will be located in a specific directory. Each installation method has its own writing directory, so it’s important to preserve the same method while installing new modules or updating the installed ones.

If the modules were installed via direct file upload and then updated via composer, you might face the following error while running setup scripts:

Autoload error: Module 'Amasty_Base' from '/app/code/Amasty/Base' has been already defined in '/vendor/amasty/base'

It means that the same files were located in two different directories at the same time, which doesn’t allow Magento to deploy properly. To resolve this, remove all the duplicated files and/or directories from app/code directory - the module configuration is stored in the DB, so it will be preserved. Be cautious not to remove important customizations/fixes and make sure to create a backup beforehand.