I'm trying to uninstall a module (my own) that I've installed via composer using CLI with this command:

bin/magento module:uninstall -r [Namespace]_[Module]  

Based on the answer provided here by @RyanH I've created the Setup/Uninstall.php file that removes database related data of the module.

This works perfectly but the uninstall procedure hangs.

I've even left the script running over night and still the same result.
The extension files are still there in the vendor module.
I didn't touch the file permissions or owner.

What goes right:

  • the database related data is removed
  • the module name is removed from the table setup_module
  • the module name is removed from app/etc/config.php.

What goes wrong:

  • the module files are still there in the vendor folder.
  • the console command does not finish.

Console output:

You are about to remove code and/or database tables. Are you sure?[y/N]y
Enabling maintenance mode
You are removing data without a database backup.
Removing data of [Namespace]_[Module]
Removing [Namespace]_[Module] from module registry in database
Removing [Namespace]_[Module] from module list in deployment configuration
Removing code from Magento codebase:

After this it just hangs.

Is there anyway to finish the uninstall process, or at least debug it?

  • even I am facing the same issue . What is the solution for this . Do you have any idea
    – Vigna S
    Commented Feb 23, 2017 at 11:36
  • Not exactly. At one point it started working. I did a debug following the provided answer but did not find anything relevant.
    – Marius
    Commented Feb 23, 2017 at 11:38
  • ok, Thank you!!! So how to uninstall the module
    – Vigna S
    Commented Feb 23, 2017 at 11:41
  • Run the command listed in the question
    – Marius
    Commented Feb 23, 2017 at 11:42
  • I am using that only but it stuck in ,'Removing code from Magento codebase:'. After which it hangs
    – Vigna S
    Commented Feb 23, 2017 at 11:44

5 Answers 5


The part of the uninstall process were it hands can be found under setup/src/Magento/Setup/Model/ModuleUninstaller.php :

public function uninstallCode(OutputInterface $output, array $modules)
    $output->writeln('<info>Removing code from Magento codebase:</info>');
    $packages = [];
    /** @var \Magento\Framework\Module\PackageInfo $packageInfo */
    $packageInfo = $this->objectManager->get('Magento\Framework\Module\PackageInfoFactory')->create();
    foreach ($modules as $module) {
        $packages[] = $packageInfo->getPackageName($module);

Basically it lists the packages to remove and then run a composer remove command on those packages via lib/internal/Magento/Framework/Composer/Remove.php :

public function remove(array $packages)
    $composerApplication = $this->composerApplicationFactory->create();

    return $composerApplication->runComposerCommand(
            'command' => 'remove',
            'packages' => $packages

You can find the runComposerCommand method in vendor/magento/composer/src/MagentoComposerApplication.php :

public function runComposerCommand(array $commandParams, $workingDir = null)

    if ($workingDir) {
        $commandParams[self::COMPOSER_WORKING_DIR] = $workingDir;
    } else {
        $commandParams[self::COMPOSER_WORKING_DIR] = dirname($this->composerJson);

    $input = $this->consoleArrayInputFactory->create($commandParams);

    $exitCode = $this->consoleApplication->run($input, $this->consoleOutput);

    if ($exitCode) {
        throw new \RuntimeException(
            sprintf('Command "%s" failed: %s', $commandParams['command'], $this->consoleOutput->fetch())

    return $this->consoleOutput->fetch();

To me something happens along the way here and those functions are where you should start debugging.

Maybe you module composer.json file is missing or has an error.

  • my ccmposer file is there. This looks like a good place to start debugging. Thanks.
    – Marius
    Commented Jul 1, 2016 at 10:52
  • years later this has helped me understand why my uninstalls didnt work - I have to call composer like /usr/local/bin/ea-php72 ~/bin/composer/composer.phar and obviously the config is not up for it...
    – iphigenie
    Commented Jan 26, 2020 at 16:18

when we run bin/magento module: uninstall Module_Name then it run composer update command also in back process that is not shown in cli.

When we run the composer update then it requires username and password that your magento marketplace account. if you have not then create :

To create authentication keys:

  1. Log in to the Magento Marketplace. If you don’t have an account, click Register.

  2. Click your account name in the top-right of the page and select My Profile.

  3. Click Access Keys in the Marketplace tab.

enter image description here

Run this command from your magento root directory ln -s ~/.composer/auth.json var/composer_home/ it will create symbolic link of your composer auth.json

When we run module: uninstall then it check auth.json in magento var folder or magento root directory.

It work for me.


It requires the Credentials for the repository from where you have installed that module and it fails to find it and consequently it hangs up. So you have to mention the credentials first.

Please refer to the answer over here


apparently I ran

composer remove vendor/module --ignore-platform-reqs

to uninstall the module that I had installed through composer.


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>

How to use the new repo.magento.com

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.