craftcms / cms

Build bespoke content experiences with Craft.
https://craftcms.com
Other
3.27k stars 635 forks source link

Missing Component Class – craft\errors\MissingComponentException #2119

Closed Anubarak closed 6 years ago

Anubarak commented 6 years ago

Description

I made a composer update in order to update our Craft 3 project to the latest version but now I don't have access to my entries/categories. Because I receive the following
Component class 'craft\elements\Entry' belongs to an uninstalled plugin ('default').

craft\errors\MissingComponentException: Component class 'craft\elements\Entry' belongs to an uninstalled plugin ('default'). in /var/www/secondred/craft3/htdocs/vendor/craftcms/cms/src/helpers/Component.php:70
Stack trace:
#0 /var/www/secondred/craft3/htdocs/vendor/craftcms/cms/src/services/Elements.php(140): craft\helpers\Component::createComponent(Array, 'craft\\base\\Elem...')
#1 /var/www/secondred/craft3/htdocs/vendor/twig/twig/lib/Twig/Extension/Core.php(1595): craft\services\Elements->createElement(Array)
#2 /var/www/secondred/craft3/htdocs/vendor/craftcms/cms/src/helpers/Template.php(76): twig_get_attribute(Object(craft\web\twig\Environment), Object(Twig_Source), Object(craft\services\Elements), 'createElement', Array, 'method', false, false)
#3 /var/www/secondred/craft3/htdocs/storage/runtime/compiled_templates/28/281703b05014d1d4f5d2a7d493718bdedeeb9b028e922b7c44c666214bfbb154.php(27): craft\helpers\Template::attribute(Object(craft\web\twig\Environment), Object(Twig_Source), Object(craft\services\Elements), 'createElement', Array, 'method')
#4 /var/www/secondred/craft3/htdocs/vendor/twig/twig/lib/Twig/Template.php(389): __TwigTemplate_ecd44b96e3d1953f84d767af88adb90059692c19199145f60733125a55f61999->doDisplay(Array, Array)
#5 /var/www/secondred/craft3/htdocs/vendor/craftcms/cms/src/web/twig/Template.php(51): Twig_Template->displayWithErrorHandling(Array, Array)
#6 /var/www/secondred/craft3/htdocs/vendor/twig/twig/lib/Twig/Template.php(366): craft\web\twig\Template->displayWithErrorHandling(Array, Array)
#7 /var/www/secondred/craft3/htdocs/vendor/craftcms/cms/src/web/twig/Template.php(32): Twig_Template->display(Array, Array)
#8 /var/www/secondred/craft3/htdocs/storage/runtime/compiled_templates/ab/ab719cb6329e35ff0ea7eebd791b9face055c1dfcd433ac9c2d4c19892832dc1.php(39): craft\web\twig\Template->display(Array, Array)
#9 /var/www/secondred/craft3/htdocs/vendor/twig/twig/lib/Twig/Template.php(389): __TwigTemplate_c7a2154eb0038e7cba32a4ae4467e61ee3e7927e17749346b23b35eeab885935->doDisplay(Array, Array)
#10 /var/www/secondred/craft3/htdocs/vendor/craftcms/cms/src/web/twig/Template.php(51): Twig_Template->displayWithErrorHandling(Array, Array)
#11 /var/www/secondred/craft3/htdocs/vendor/twig/twig/lib/Twig/Template.php(366): craft\web\twig\Template->displayWithErrorHandling(Array, Array)
#12 /var/www/secondred/craft3/htdocs/vendor/craftcms/cms/src/web/twig/Template.php(32): Twig_Template->display(Array, Array)
#13 /var/www/secondred/craft3/htdocs/vendor/twig/twig/lib/Twig/Template.php(374): craft\web\twig\Template->display(Array)
#14 /var/www/secondred/craft3/htdocs/vendor/twig/twig/lib/Twig/Environment.php(288): Twig_Template->render(Array)
#15 /var/www/secondred/craft3/htdocs/vendor/craftcms/cms/src/web/View.php(292): Twig_Environment->render('entries', Array)
#16 /var/www/secondred/craft3/htdocs/vendor/craftcms/cms/src/web/View.php(340): craft\web\View->renderTemplate('entries', Array)
#17 /var/www/secondred/craft3/htdocs/vendor/craftcms/cms/src/web/Controller.php(101): craft\web\View->renderPageTemplate('entries', Array)
#18 /var/www/secondred/craft3/htdocs/vendor/craftcms/cms/src/controllers/TemplatesController.php(79): craft\web\Controller->renderTemplate('entries', Array)
#19 [internal function]: craft\controllers\TemplatesController->actionRender('entries', Array)
#20 /var/www/secondred/craft3/htdocs/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#21 /var/www/secondred/craft3/htdocs/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#22 /var/www/secondred/craft3/htdocs/vendor/yiisoft/yii2/base/Module.php(528): yii\base\Controller->runAction('render', Array)
#23 /var/www/secondred/craft3/htdocs/vendor/craftcms/cms/src/web/Application.php(242): yii\base\Module->runAction('templates/rende...', Array)
#24 /var/www/secondred/craft3/htdocs/vendor/yiisoft/yii2/web/Application.php(103): craft\web\Application->runAction('templates/rende...', Array)
#25 /var/www/secondred/craft3/htdocs/vendor/craftcms/cms/src/web/Application.php(207): yii\web\Application->handleRequest(Object(craft\web\Request))
#26 /var/www/secondred/craft3/htdocs/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#27 /var/www/secondred/craft3/htdocs/web/index.php(22): yii\base\Application->run()
#28 {main}

I created a default plugin few months ago with pluginfactory.io but it was totally empty - I made no changes - and I deleted it afterwards and removed it from our composer file. After that I made several composer updates with different plugins but after the last system update everything crashes. The "Default" Plugin appears in the admin/settings/plugins page even through there are no files for it anywhere. Not in my custom plugins folder nor in the vendor folder and there is no composer.json for it anywhere. So I'm a bit clueless what to do

Additional info

Edit:

The error is here

// If it comes from a plugin, make sure the plugin is installed
$pluginsService = Craft::$app->getPlugins();
$pluginHandle = $pluginsService->getPluginHandleByClass($class);
if ($pluginHandle !== null && $pluginsService->getPlugin($pluginHandle) === null) {
    $pluginInfo = $pluginsService->getComposerPluginInfo($pluginHandle);
    $pluginName = $pluginInfo['name'] ?? $pluginHandle;
    throw new MissingComponentException("Component class '{$class}' belongs to an uninstalled plugin ('{$pluginName}').");
}

$class is craft\fields\Dropdown and $pluginHandle is default-plugin how can it be that the field is linked to a non existing plugin? When I remove the condition or just insert a false && everything works fine

brandonkelly commented 6 years ago

Check your vendor/craftcms/plugins.php file. There’s probably a reference to your Default plugin in there.

Anubarak commented 6 years ago

Thank you very much Brandon, removing that plugin from the file helped and I got rid of this (and a few more) errors related to the plugin. The topic can be closed

brandonkelly commented 6 years ago

@Anubarak good to hear. FFR if you want to remove a plugin, make sure to do it with the composer remove command, rather than deleting the files manually.