11

How to uninstall module ?
I read this document: http://devdocs.magento.com/guides/v2.0/install-gde/install/cli/install-cli-uninstall-mods.html#instgde-cli-uninst-mod-uninst
But it was not succcessful, and display below:

php bin/magento module:uninstall SP_Gridthumbs
SP_Gridthumbs is not an installed composer package

38

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

  • How to remove all this module out of project, your way just disable. – MrTo-Kane Mar 8 '16 at 10:03
  • @MagentoOdoo.com see my update – Marius Mar 8 '16 at 10:12
  • You should also clean the cache – WaPoNe Feb 1 '17 at 13:53
  • 3
    I tested it. Remove the line with SP_Gridthumbs from app/etc/config.php doesn't need. Magento will auto remove the record by run php bin/magento setup:upgrade – Key Shang Nov 10 '17 at 9:01
10

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

4

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
  • Running setup: upgrade while there are modules that were not installed via composer will get them being installed and enabled again which defeats the purpose. – Mohammed Joraid Jul 10 '18 at 5:44
  • 1
    @MohammedJoraid see updated answer – Arvind07 Jul 25 '18 at 6:32
0

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:uninstall -r <Vendor>_<Module>    
php bin/magento module:uninstall -r <Vendor>_<Module>

Hope Someone get help

0

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

php bin/magento module:disable modulename

because this checks for dependencies...

0

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

Step 1: Remove the module Vendor_% 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/%

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

 DELETE FROM core_config_data WHERE path LIKE 'vendor%';
Step 5: Remove module from setup_module table by running the following query

 DELETE FROM setup_module WHERE module LIKE 'vendor_%';
Step 6: 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

-5
  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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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