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/.
Related Articles
Composer doesn’t allow me to update the module to the latest version. Is there a solution for it?
While updating Amasty extensions via composer, you may encounter a Nothing to install, update or remove message, as if there are no updates for the modules. There are several possible reasons why the composer is not fetching the latest version of the ...
How to proceed if I need to update Amasty Base extension?
To finish license registration for your amasty.com account, you need to enter your Instance Registration Key into our Base module functionality that becomes available with v.1.16.0 and newer. In order to check your Base module version and its latest ...
I’m trying to install the module via composer, but the package is not found. How to resolve it?
Composer is the dependency manager that allows you easily download the required files on your server. The files are located on a remote server, or a repository, that you need to add to the list of “known” ones and authenticate to using the username ...
How to apply a patch to avoid overwriting modified files when updating the module?
Magento allows adding patches to Composer in order to prevent modifications from being overwritten while updating the extension. To apply the patch using Composer, follow the guidelines below. Please note that this instruction works only for patches ...
How to update an Amasty extension?
Below you can find a step-by-step guide for updating your Amasty extensions to latest versions. Before updating the module, it's recommended to create a backup of the modified extension files (if any). When the update is finished, you can re-apply ...