[Resolved] Mageplaza_Core has been already defined
imsamthomas opened this issue ยท 45 comments
Few customers reported to us the following issue:
Issue
Module 'Mageplaza_Core' from app/code/Mageplaza/Core
has been already defined in vendor/mageplaza/core-m2
.
Explain
There are 2 different ways to install Mageplaza extensions:
- Copy and paste: download from our store https://www.mageplaza.com
- Composer command
Because you installed Mageplaza Extensions via composer and now install by copying a package from our store.
In this case, it conflicts Core module. Now we are going to resolve this issue in 3 simple steps:
Solution
Step 1: You should DELETE Core module from
app/code/Mageplaza/Core
vendor/mageplaza/core-m2
(if any)
Run the following command:
composer remove mageplaza/core-m2
rm -rf app/code/Mageplaza/Core
rm -rf vendor/mageplaza/core-m2
composer dump-autoload
Step 2: Now install Mageplaza_Core again run upgrade command line to resolve the issue.
composer require mageplaza/module-core
php bin/magento setup:upgrade
Step 3: Check result
Check the result, if there is still an issue, feel free to leave a comment here or contact us
I get
Autoload error: Module 'Mageplaza_Core' from '/vendor/mageplaza/module-core' has been already defined in '/vendor/mageplaza/core-m2'
by deleting 'vendor/mageplaza/module-core' doesn't work though...the upgrade command doesn't even run.
Same result as nsid32: nothing works and upgrade not working neither
I deleted app/code/Mageplaza/Core
and when I type the command php bin/magento setup:upgrade
Then I got the error:
Autoload error: Module 'Mageplaza_Core' from '/var/www/html/magento2/vendor/mageplaza/module-core' has been already defined in '/var/www/html/magento2/vendor/mageplaza/core-m2'.ubuntu@ip-175-33-22-175:/var/www/html/magento2$
You should delete both folders:
app/code/Mageplaza/Core
vendor/mageplaza/core-m2
Keep folder vendor/mageplaza/module-core
Ok, so I delete vendor/mageplaza/core-m2
and then:
ubuntu@ip-175-33-22-175:/var/www/html/magento2$ php bin/magento setup:upgrade
Autoload error: Module 'Mageplaza_Core' from '/var/www/html/magento2/vendor/mageplaza/module-core' has been already defined in '/var/www/html/magento2/vendor/mageplaza/core-m2'.ubuntu@ip-175-33-22-175:/var/www/html/magento2$ php bin/magento setup:upgrade
PHP Warning: require(/var/www/html/magento2/vendor/composer/../mageplaza/core-m2/registration.php): failed to open stream: No such file or directory in /var/www/html/magento2/vendor/composer/autoload_real.php on line 71
PHP Fatal error: require(): Failed opening required '/var/www/html/magento2/vendor/composer/../mageplaza/core-m2/registration.php' (include_path='/var/www/html/magento2/vendor/phpunit/php-file-iterator:/var/www/html/magento2/vendor/phpunit/phpunit:/var/www/html/magento2/vendor/symfony/yaml:/var/www/html/magento2/vendor/magento/zendframework1/library:.:/usr/share/php') in /var/www/html/magento2/vendor/composer/autoload_real.php on line 71
vendor/mageplaza/module-core
folder it's still in its place
Edit: finally it worked, but first I had to remove the line of the las module I added to composer.json
- Delete
vendor/mageplaza/core-m2
. - run command
composer dump-autoload
- run command
php bin/magento setup:upgrade
if you're using any mageplaza language packs core-m2
might be required... so that makes these two modules conflict
why are there two versions of the core module floating around?
what's the permanent solution here? Everytime I do a new composer require core-m2 gets back in the mix
this is the real correct answer. Many thanks for sharing!
Is there a final solution?
For the moment every time I do some setup:static-content:deploy
or setup:upgrade
I get the following message:
Autoload error: Module 'Mageplaza_Core' from '/mage2/vendor/mageplaza/core-m2' has been already defined in '/mage2/vendor/mageplaza/module-core'.
The only way to get around it is like @eddyonboard described, installing the new module-core
is ending up in the same problem because this installs core-m2
version 1.3.1
It's a combination of @eddyonboard and @imsamthomas posts I as it's resolved for me currently.
Delete vendor/mageplaza/core-m2
composer remove mageplaza/core-m2
composer dump-autoload
composer require mageplaza/module-core
php bin/magento setup:upgrade
@blizam I can confirm your answer is perfectly valid ๐
However I can not confirm. Every time I run composer and a dependency check is made, it will reinstall mageplaza/core-m2
So I searched trough all mageplaza extensions (all installed by composer!) and found out that the norwegian language pack requires mageplaza/core-m2 in its composer.json which is the reason why core-m2 is installed again and again no matter what I do.
So my solution was to run:
composer remove mageplaza/magento-2-norwegian-language-pack
composer clear-cache
composer remove mageplaza/core-m2
composer dump-autoload
php bin/magento setup:upgrade
I also created a pull request to correct the composer.json
Thanks @blizam @alen12345 @plastikschnitzer
I have updated the solution on top of this topic: #3 (comment)
Information for anyone using theme Porto.
If you use Porto theme you will get Mageplaza_Core has been already defined error.
app/code/Mageplaza/Core
app/code/Mageplaza/LayeredNavigation
are included in the Porto installation.
I did not use the layered navigation so I followed #3 (comment)
I did these steps.
rm -rf app/code/Mageplaza/Core
php bin/magento setup:upgrade
I dont know if it's ok to leave the app/code/Mageplaza/LayeredNavigation but it's disabled so it should not be any problem.
@inelukipg It's all right, as long as you disable it (via module:disable), it won't run in any case.
@gixid192 Ok! Do you know why there is different core modules from Mageplaza with different names?
module-core, Core, core-m2?
@inelukipg Sorry if that made you confused.
As our business grows, we changed the name time to time. The reason is Magento offers 2 different ways of installing extensions so some installed by Composer, others prefer copy/paste method.
We are trying to fix this issue by instructing users to install core-module by composer, as you can see from our user guide here: https://www.mageplaza.com/install-magento-2-extension/
@gixid192 Ok, but vendor/mageplaza/module-core is the latest version?
I mean if I decide to buy another extension from Mageplaza and install via composer it will work with that core module?
@inelukipg oh yes, that's the latest name if you are using Composer.
You can just follow our user guide (the link I gave above), everything will be all right.
follow @inelukipg's answer #3 (comment) if have yourstore theme and try to install a lang package
I can't not remove your core plugin I'm getting this error and Mageplaza_Affiliate is disabled as well as Mageplaza_Core. after doing this I also tried to remove the extention by doing composer remove mageplaza/module-core and I'm getting this error now
PHP Fatal error: Class 'Mageplaza\Core\Helper\AbstractData' not found in /chroot/home/newcloud/cloudvdesign.com/html/app/code/Mageplaza/Affiliate/Helper/Data.php on line 20
Fatal error: Class 'Mageplaza\Core\Helper\AbstractData' not found in /chroot/home/newcloud/cloudvdesign.com/html/app/code/Mageplaza/Affiliate/Helper/Data.php on line 20
We want to remove this plugin completely because it simply doesnt work
Your store cannot run without Mageplaza_Core module.
You removed the old Core module, then you should install the new one via composer:
Step 2 : Now run upgrade command line to resolve the issue.
composer require mageplaza/module-core
php bin/magento setup:upgrade
@imsamthomas your solution on top works well for one time, but you need to update the Norwegian language pack to avoid the problems, every composer command re installs core-m2.
Please merge the pull request asap - mageplaza/magento-2-norwegian-nynorsk-language-pack#3
@dinkeronline thanks for notifying us here.
We have pulled the pacakge.
@imsamthomas Can you help me for install sociallogin_v2.4.0.1_ce_mageplaza extension in magento 2 store.in sociallogin_v2.4.0.1_ce_mageplaza extension ZIP file i have 2 folder -app, lib.i have read your all reply for install this extension(sociallogin_v2.4.0.1_ce_mageplaza).but i need help
Can you tell me Step by step process for install this extension.
and Mageplaza_Core module i have zip file.when i have extract this file i have found
Block, Controller, etc, Helper, i18n, Model, Observer, view folder. how to install this module. i mean here is not app folder etc.
just follow this
Delete the following files, folders::
app/code/Mageplaza/EXTENSION_NAME
Run the following command line::
php bin/magento setup:upgrade
solution indicated by @imsamthomas worked. Thx!
Does this means that magento comes already with that module preinstalled? cuz I did not uploaded any module directly, but only through composer..
thanks @inelukipg, it works.
im getting
Module 'Mageplaza_Core' from '/app/code/Mageplaza/Core' has been already defined in '/vendor/mageplaza/module-core'.
not core_m2
@thrmda The core_m2
is the old name, you can follow the insturction by replacing it with the new name module-core
install midnight-commander[dot]org and delete
#mc
/var/www/html/magento/app/code/Mageplaza/Core
foder via 'F8' keys just all
It worked for me .. thanks buddy
Solution worked for me and saved my butt. Thank you so much!!
When I implement this resolution (using porto) I get a lot of errors when running: php bin/magento setup:static-content:deploy -f
For this reason, I have had to make sure to not use any other mageplaza extensions, unfortunately :( It was tested on 2.3.3. We are on 2.3.5-p1 now and I will test one more time, but I expect the result to be the same.
Edit: I have tried on 2.3.5-p1 and it is now working properly.
Thank you for the solution provided by @imsamthomas it worked perfectly, im using magento CE 2.3.5-p1 with Porto theme, production site. You saved my day!
I got an error that Class Mageplaza\CustomerApproval\Console\Command\Approve\Interceptor does not exist. Please specify the solution
If using Porto & Mageplaza Search module, try this:
composer remove mageplaza/core-m2
rm -rf app/code/Mageplaza/Core
rm -rf vendor/mageplaza/core-m2
rm -rf app/code/Mageplaza/Search
composer dump-autoload
composer require mageplaza/module-core
php bin/magento setup:upgrade
For Mageplaza it is mandatory to have the Mageplaza_Core module.
After that, all errors will be resolved.
Thanks
For Mageplaza it is mandatory to have the Mageplaza_Core module.
After that, all errors will be resolved.Thanks
I had it, but in spite of having the Mageplaza_Core module, errors can still occur, because of various reasons such as using theme such as Porto where the Mageplaza_Search module comes bundled etc.
im in magento 2.4. your module supports only magento 2.3.x ????
please help me. Thank you
Hi, I followed the instructions above and everything worked till the sudo php bin/magento setup:upgrade, I get one last line that says "Invalid entity_type specified: themelayout_maincontent " should I be concerned. Thank you in advance.