1

I am working on a plugin in Craft:3.4. I get this error while trying to install the plugin in the CP.

yii\base\ErrorException: include(/app/vendor/composer/../wittsstratts/craft-company/src/Company.php): failed to open stream: No such file or directory in /app/vendor/composer/ClassLoader.php:444
Stack trace:
#0 /app/vendor/craftcms/cms/src/web/ErrorHandler.php(74): yii\base\ErrorHandler->handleError(2, 'include(/app/ve...', '/app/vendor/com...', 444)
#1 /app/vendor/composer/ClassLoader.php(444): craft\web\ErrorHandler->handleError(2, 'include(/app/ve...', '/app/vendor/com...', 444, Array)
#2 /app/vendor/composer/ClassLoader.php(444): include()
#3 /app/vendor/composer/ClassLoader.php(322): Composer\Autoload\includeFile('/app/vendor/com...')
#4 [internal function]: Composer\Autoload\ClassLoader->loadClass('wittsstratts\\co...')
#5 [internal function]: spl_autoload_call('wittsstratts\\co...')
#6 /app/vendor/craftcms/cms/src/services/Plugins.php(873): is_subclass_of('wittsstratts\\co...', 'craft\\base\\Plug...')
#7 /app/vendor/craftcms/cms/src/services/Plugins.php(478): craft\services\Plugins->createPlugin('company')
#8 /app/vendor/craftcms/cms/src/controllers/PluginsController.php(50): craft\services\Plugins->installPlugin('company', NULL)
#9 [internal function]: craft\controllers\PluginsController->actionInstallPlugin()
#10 /app/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#11 /app/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#12 /app/vendor/craftcms/cms/src/web/Controller.php(178): yii\base\Controller->runAction('install-plugin', Array)
#13 /app/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('install-plugin', Array)
#14 /app/vendor/craftcms/cms/src/web/Application.php(290): yii\base\Module->runAction('plugins/install...', Array)
#15 /app/vendor/craftcms/cms/src/web/Application.php(558): craft\web\Application->runAction('plugins/install...', Array)
#16 /app/vendor/craftcms/cms/src/web/Application.php(269): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#17 /app/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#18 /app/web/index.php(21): yii\base\Application->run()
#19 {main}

This question is related to this but with a different setup.

Tools:

Docker:19.03.5

Composer:1.10-dev

This might help anyone facing this same issue.

I found the reason for the error was because I was using docker. Composer symlinks the plugin from its physical directory into craft's vendor directory. The plugin directory as a result of this was not mounted into docker container. Thus, craft was not able to locate the plugin directory. All I did to fix this was move the project(plugin) into craft's vendor director.

| improve this question | | | | |
  • Please can you share the content of your composer.json file? It looks like one of your dependencies (perhaps a custom plugin or module) is not found. – Romain Poirier Feb 24 at 15:26
  • @RomainPoirier, I was able to fix it. I've updated my question. Kindly check. Thank you – Segun Ogundipe Feb 24 at 17:22
  • Could you share your update as an official answer, @SegunOgundipe? – Brad Bell Feb 24 at 22:26
  • Done. @BradBell – Segun Ogundipe Feb 25 at 9:16
  • Thanks!! @SegunOgundipe – Brad Bell Feb 25 at 23:10
1

Composer symlinked the plugin from its physical directory into craft's vendor directory. The plugin directory as a result of this was not mounted into the docker container. Thus, craft was not able to locate the plugin as it wasn't mounted into my docker container. All I did to fix this was move the project(plugin) into craft's vendor director.

| improve this answer | | | | |

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.