Answers:
它在您链接的文档中说:
该命令仅适用于定义为Composer软件包的模块。
如果您没有通过composer安装该模块,它将无法正常工作。
您只能通过禁用它bin/magento module:disable SP_Gridthumbs
。
要删除模块,请删除文件夹SP/Gridthumbs
,从表中setup_module
删除模块='SP_Gridthumbs'的记录,并删除由模块安装添加的任何其他表或记录。
同时SP_Gridthumbs
从中删除行app/etc/config.php
Remove the line with SP_Gridthumbs from app/etc/config.php
不需要 Magento将通过运行自动删除记录php bin/magento setup:upgrade
以下是手动卸载Magento 2的模块的步骤
{folder path}\app\code
setup_module
运行命令
{magento项目根路径}> {php路径} \ php.exe bin / magento setup:upgrade =>安装程序升级
{magento项目根路径}> {php路径} \ php.exe bin / magento缓存:刷新=>清除缓存
怎么样:
php bin/magento module:disable <ExtensionProvider_ExtensionName> --clear-static-content
composer remove VendorName/VendorExtensionRepository
php bin/magento setup:upgrade
对于作曲家模块:
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
卸载Composer已安装模块的步骤
卸载应用程序/代码中手动添加的模块的步骤
这是逐步指南,可手动卸载MAGENTO 2的任何第三方模块。
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
自定义Magento2模块
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.
有关卸载第3方/ composer已安装扩展的更多信息
https://www.scommerce-mage.com/blog/magento2-uninstall-module.html
Magento 2:如何卸载模块
1.如果您手动安装它:
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.如果您是通过作曲家安装的:
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
希望有人得到帮助
setup/src/Magento/Setup/Console/Command/ModuleUninstallCommand.php
并更换
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;
}
与
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;
}
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);
}
$this->remove->remove($packages);
}
与
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);
}
}
注意,不建议在生产服务器上使用该解决方案