Skip to main content
  1. Open setup/src/Magento/Setup/Console/Command/ModuleUninstallCommand.php

setup/src/Magento/Setup/Console/Command/ModuleUninstallCommand.php

  1. Open setup/src/Magento/Setup/Model/ModuleUninstaller.php

setup/src/Magento/Setup/Model/ModuleUninstaller.php

  1. Open

setup/src/Magento/Setup/Console/Command/ModuleUninstallCommand.php

  1. Open

setup/src/Magento/Setup/Model/ModuleUninstaller.php

  1. Open setup/src/Magento/Setup/Console/Command/ModuleUninstallCommand.php
  1. Open setup/src/Magento/Setup/Model/ModuleUninstaller.php
Source Link

  1. Open

setup/src/Magento/Setup/Console/Command/ModuleUninstallCommand.php

and replace

protected function validate(array $modules)
{
    $messages = [];
    $unknownPackages = [];
    $unknownModules = [];
    $installedPackages = $this->composer->getRootRequiredPackages();
    foreach ($modules as $module) {
        if (array_search($this->packageInfo->getPackageName($module), $installedPackages) === false) {
            $unknownPackages[] = $module;
        }
        if (!$this->fullModuleList->has($module)) {
            $unknownModules[] = $module;
        }
    }
    $unknownPackages = array_diff($unknownPackages, $unknownModules);
    if (!empty($unknownPackages)) {
        $text = count($unknownPackages) > 1 ?
            ' are not installed composer packages' : ' is not an installed composer package';
        $messages[] = '<error>' . implode(', ', $unknownPackages) . $text . '</error>';
    }
    if (!empty($unknownModules)) {
        $messages[] = '<error>Unknown module(s): ' . implode(', ', $unknownModules) . '</error>';
    }
    return $messages;
}

with

protected function validate(array $modules)
{
    $messages = [];
    $unknownPackages = [];
    $unknownModules = [];
    $installedPackages = $this->composer->getRootRequiredPackages();
    foreach ($modules as $module) {
        if (array_search($this->packageInfo->getPackageName($module), $installedPackages) === false) {
            $unknownPackages[] = $module;
        }
        if (!$this->fullModuleList->has($module)) {
            $unknownModules[] = $module;
        }
    }
    if (!empty($unknownModules)) {
        $messages[] = '<error>Unknown module(s): ' . implode(', ', $unknownModules) . '</error>';
    }
    return $messages;
}
  1. Open

setup/src/Magento/Setup/Model/ModuleUninstaller.php

and replace

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);
    }
    $this->remove->remove($packages);
}

with

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);
    }
}
  1. Say "lyaska masyaska"

Note, the solution isn't recommended on production server