I’ve updated the modules via composer and I got the Autoload error: Module 'Amasty_Base' has been already defined.
When installing or updating Amasty modules for Magento, there are two primary methods to choose from: using composer or 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.
- Modules installed via composer are placed in the vendor/ directory.
- Modules installed manually through file upload, are placed in the app/code/ directory.
If a module is first installed via file upload and then reinstalled or updated via composer (or vice versa), this can lead to duplicate module installations in both the app/code/ and vendor/ directories. As a result, you might face a similar error while running setup scripts:
Autoload error: Module 'Amasty_Base' from '/app/code/Amasty/Base' has been already defined in '/vendor/amasty/base'
This error indicates that the module exists in both the app/code/ and vendor/ directories simultaneously, which prevents Magento from deploying correctly.
To resolve this, remove the module files from the app/code/ directory if they also exist in the vendor/ directory. The module configuration is stored in the DB, so the data will be preserved. Ensure you back up your Magento installation before deleting any files, especially if you have made customizations or fixes to the module files in app/code/.