Question

How to uninstall module ?

I read this document

But it was not successful, and display below:

php bin/magento module:uninstall SP_Gridthumbs 

SP_Gridthumbs is not an installed composer package

Was it helpful?

Solution

it says in the documentation you linked, this:

This command works only with modules defined as Composer packages.

If you did not install the module via composer, it won't work.
You can only disable it via bin/magento module:disable SP_Gridthumbs.

To remove the module, remove the folder SP/Gridthumbs, remove the record with module = 'SP_Gridthumbs' from the table setup_module and remove any other tables or records added by the install of the module.
Also remove the line with SP_Gridthumbs from app/etc/config.php

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 setup_module

  • Run command

    {magento project root path}>{php path}\php.exe bin/magento setup:upgrade => Setup Upgrade

    {magento project root path}>{php path}\php.exe bin/magento cache:flush => Clear Cache

How about:

php bin/magento module:disable <ExtensionProvider_ExtensionName> --clear-static-content
composer remove VendorName/VendorExtensionRepository
php bin/magento setup:upgrade

For composer modules:

php bin/magento module:disable <ExtensionProvider_ExtensionName> --clear-static-content
php bin/magento module:uninstall <ExtensionProvider_ExtensionName> -r
composer update
php bin/magento setup:upgrade

HERE IS THE STEP BY STEP GUIDE TO UNINSTALL ANY THIRD PARTY MODULE FROM MAGENTO 2 MANUALLY.

Step 1: Remove the module Vendor_Mymodule from app\etc\config.php

Step 2: Drop module tables or columns from database, please check app\code\Vendor\Module\Setup folder for more information

Step 3: Remove the folder app\code\vendor\Mymodule

Step 4: Remove module configuration settings from core_config_data table by running the following query


 DELETE FROM setup_module WHERE module LIKE 'vendor_Mymodule';
Step 5: Run the following command by logging onto your SSH server

 php bin/magento setup:upgrade
But if you have installed the module via composer then you can run the following list of commands by SSHing on the box to uninstall third party module

 php bin/magento module:uninstall -r {{module_name}}
for example

php bin/magento module:uninstall -r Scommerce_GoogleTagManagerPro
-r flag removes module data 

Run the following command once module has been successfully uninstalled.

 php bin/magento setup:upgrade

To Custom Magento2 Module

step1: disable the module 
$php bin/magento module:disable Vendor_MyModule
step2: remove the folder from directory app/code/Vendor
step3: remove the line of code from app/etc/config.php file.

for more on uninstalling 3rd party/composer installed extensions

https://www.scommerce-mage.com/blog/magento2-uninstall-module.html

Steps to uninstall a composer installed module

  • bin/magento module:disable Namespace_ModuleName
  • bin/magento module:uninstall Namespace_ModuleName
  • composer remove namespace/module-name
  • bin/magento cache:flush

Steps to uninstall a manually added module in app/code

  • bin/magento module:disable Namespace_ModuleName
  • remove directory from app/code manually
  • bin/magento setup:upgrade
  • bin/magento cache:flush

I think it's wise to first disable the module using

php bin/magento module:disable modulename

because this checks for dependencies...

Uninstall extension from magento 2:

  1. Go to your magento project directory in CLI and check for module status, by running command php bin/magento module:status

  2. If it is enable make it disable by running command php bin/magento module:disable <extension name>

  3. Go to database and search for 'setup_module' table and search for your extension name and delete it

  4. Delete the your extension name folder from app/code folder

  5. Run the setup:upgrade command.

  6. You have succesfulley uninstalled the extension.

Magento 2: How to uninstall module

1. If you installed it manually:

remove the folder app/code/<Vendor>/<Module>
drop module tables from database
remove the config settings.

DELETE FROM core_config_data WHERE path LIKE 'vendor_module/%'   
DELETE FROM core_config_data WHERE path LIKE 'vendor_module/%'

remove the module <Vendor>_<Module> from app/etc/config.php

remove the module <Vendor>_<Module> from table setup_module

DELETE FROM setup_module WHERE module='<Vendor>_<Module>'    
DELETE FROM setup_module WHERE module='<Vendor>_<Module>'

2.If you installed it via composer:

run this in console
php bin/magento module:status
php bin/magento module:disable mirasvit/module-core --clear-static-content
php bin/magento module:uninstall -r <Vendor>_<Module>    
php bin/magento setup:upgrade
php bin/magento c:f
composer remove mirasvit/module-core

Hope Someone get help

php bin/magento module:disable Amasty_Checkout

https://prnt.sc/wacrl8

verify composer cli from composer.json file of magento root directory

composer remove amasty/module-single-step-checkout

php-cli bin/magento setup:upgrade

  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

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top