Below we are going to describe how to uninstall Magento 2 extension depending on how your extension was installed (manually or via composer).
Important! Most of the extensions has dependency from another extension. For example if you remove Olegnax_Core module all other Olegnax extensions will stop work and trow an error.
1. Manual Magento 2 Extension Uninstall
1. First of all we need to find out extension name . Connect via SSH to your server and navigate to the root of your Magento installation. Run following command to get the list of extensions and check its name:
Run all Magento CLI commands as the Magento file system owner.
php bin/magento module:status
2. Run following commands to disable it. Replace Vendor_ExtensionName
with the actual extension and vendor name (i.e. : Olegnax_DeferJS):
php bin/magento module:disable Vendor_ExtensionName --clear-static-content
php bin/magento setup:upgrade
You can also disable extension in bulk. To do this simply add extension names separated by space, i.e::
php bin/magento module:disable Olegnax_DeferJS Olegnax_InstagramFeed Olegnax_Core --clear-static-content
php bin/magento setup:upgrade
3. Now you can remove extension files. Do not do this as a first step!
You can find extension files in app/code/VendorName/ExtensionName, i.e.: app/code/Olegnax/DeferJS
. Remove this folder.
You can do this using command line, i.e.:
rm -rf app/code/Olegnax/DeferJS
4. Once extension has been disabled and removed run following commands:
php bin/magento setup:di:compile php bin/magento setup:static-content:deploy -f php bin/magento cache:flush
2. How to uninstall Magento 2 Extension installed via Composer
1. First of all we need to find out extension name. Connect via SSH to your server and navigate to the root of your Magento installation. Run following command to get the list of extensions and check its name:
Run all Magento CLI commands as the Magento file system owner.
php bin/magento module:status
2. Run following commands to disable it. Replace Vendor_ExtensionName
with the actual extension and vendor name (i.e. : Olegnax_DeferJS):
php bin/magento module:disable Vendor_ExtensionName --clear-static-content
php bin/magento setup:upgrade
You can also disable extension in bulk. To do this simply add extension names separated by space, i.e::
php bin/magento module:disable Olegnax_DeferJS Olegnax_InstagramFeed Olegnax_Core --clear-static-content
php bin/magento setup:upgrade
3. Remove extension using composer remove
command:
composer remove VendorName/VendorExtensionRepository
Replace VendorName and ExtensionName with the actual extension name, i.e.:
composer remove olegnax/module-core
You can find extension repository installed via composer in vendor folder of your Magento installation. Also you can check it in composer.json that can be found inside of the extension folder. The line with name is what you need:
...
"name": "olegnax/module-core",
"description": "Olegnax Core",
"version": "1.0.9.1",
...
That’s it. Composer will remove all extension files.