Custom module uninstall
Question
I've created my uninstall class/script.
After installing my sample module using composer I can see the module working.
Then, I try to uninstall the module using:
bin/magento module:uninstall Barbanet_SampleModule
And I see this message:
You are about to remove code and/or database tables. Are you sure?[y/N]y
Enabling maintenance mode
You are about to remove a module(s) that might have database data. Do you want to remove the data from database?[y/N]y
You are removing data without a database backup.
Removing data of Barbanet_SampleModule
Removing Barbanet_SampleModule from module registry in database
Removing Barbanet_SampleModule from module list in deployment configuration
Removing code from Magento codebase:
Then I press enter a few times I got this message:
Command "remove" failed: Loading composer repositories with package information
Authentication required (repo.magento.com):
Username: Password:
[Composer\Downloader\TransportException]
Invalid credentials for 'https://repo.magento.com/packages.json', aborting.
remove [--dev] [--no-progress] [--no-update] [--update-no-dev] [--update-with-dependencies] [--ignore-platform-reqs] [packages1] ... [packagesN]
Please disable maintenance mode after you resolved above issues.
My module was removed from composer.json, also was deleted from the steup_module table and also the custom table was deleted from the database.
My composer keys are stored at my personal auth.json file too.
Someone knows why I'm getting this message and why the uninstall process isn't finishing correctly.
Solution
Alan Storm point me to this link on GitHub: Issue #2523
It seems that Magento reads the composer credentials from var/composer_home.
One solution is to create a symbolic link inside var/composer_home with:
ln -s ~/.composer/auth.json .
OTHER TIPS
Below are the steps to Uninstall Module Manually for Magento 2
- Delete the Module folder from
{folder path}\app\code
- Remove module entry from database table
setup_module
Run command
go to mangeto root in command prompt like http://prntscr.com/flx68n (go as per your folder drive)
then run command like : php bin/magento setup:upgrade then clear cache like : php -f bin/magento cache:flush
Composer stoped in load data from repo.magento.com
My auth.json was not correct. This decision helped me
config http-basic.repo.magento.com <public_key> <private_key>