1

When I attempt to run any ./craft it throws an error, for example:

$ ./craft resave/entries
Exception 'yii\base\UnknownMethodException' with message 'Calling unknown method: craft\console\Request::getSegment()'

in /var/www/examplewebsite.co.uk/vendor/yiisoft/yii2/base/Component.php:300

Stack trace:
#0 /var/www/examplewebsite.co.uk/plugins/core/src/Core.php(97): yii\base\Component->__call('getSegment', Array)
#1 /var/www/examplewebsite.co.uk/vendor/yiisoft/yii2/base/BaseObject.php(109): cursor\core\Core->init()
#2 /var/www/examplewebsite.co.uk/vendor/yiisoft/yii2/base/Module.php(158): yii\base\BaseObject->__construct(Array)
#3 /var/www/examplewebsite.co.uk/vendor/craftcms/cms/src/base/Plugin.php(130): yii\base\Module->__construct('core', Object(craft\console\Application), Array)
#4 [internal function]: craft\base\Plugin->__construct('core', Object(craft\console\Application), Array)
#5 /var/www/examplewebsite.co.uk/vendor/yiisoft/yii2/di/Container.php(400): ReflectionClass->newInstanceArgs(Array)
#6 /var/www/examplewebsite.co.uk/vendor/yiisoft/yii2/di/Container.php(159): yii\di\Container->build('cursor\\core\\Cor...', Array, Array)
#7 /var/www/examplewebsite.co.uk/vendor/yiisoft/yii2/BaseYii.php(351): yii\di\Container->get('cursor\\core\\Cor...', Array, Array)
#8 /var/www/examplewebsite.co.uk/vendor/craftcms/cms/src/services/Plugins.php(897): yii\BaseYii::createObject(Array, Array)
#9 /var/www/examplewebsite.co.uk/vendor/craftcms/cms/src/services/Plugins.php(230): craft\services\Plugins->createPlugin('core', Array)
#10 /var/www/examplewebsite.co.uk/vendor/craftcms/cms/src/base/ApplicationTrait.php(1375): craft\services\Plugins->loadPlugins()
#11 /var/www/examplewebsite.co.uk/vendor/craftcms/cms/src/console/Application.php(65): craft\console\Application->_postInit()
#12 /var/www/examplewebsite.co.uk/vendor/yiisoft/yii2/base/BaseObject.php(109): craft\console\Application->init()
#13 /var/www/examplewebsite.co.uk/vendor/yiisoft/yii2/base/Application.php(206): yii\base\BaseObject->__construct(Array)
#14 /var/www/examplewebsite.co.uk/vendor/yiisoft/yii2/console/Application.php(89): yii\base\Application->__construct(Array)
#15 /var/www/examplewebsite.co.uk/vendor/craftcms/cms/src/console/Application.php(54): yii\console\Application->__construct(Array)
#16 [internal function]: craft\console\Application->__construct(Array)
#17 /var/www/examplewebsite.co.uk/vendor/yiisoft/yii2/di/Container.php(400): ReflectionClass->newInstanceArgs(Array)
#18 /var/www/examplewebsite.co.uk/vendor/yiisoft/yii2/di/Container.php(159): yii\di\Container->build('craft\\console\\A...', Array, Array)
#19 /var/www/examplewebsite.co.uk/vendor/yiisoft/yii2/BaseYii.php(351): yii\di\Container->get('craft\\console\\A...', Array, Array)
#20 /var/www/examplewebsite.co.uk/vendor/craftcms/cms/bootstrap/bootstrap.php(244): yii\BaseYii::createObject(Array)
#21 /var/www/examplewebsite.co.uk/vendor/craftcms/cms/bootstrap/console.php(34): require('/var/www/examplewebsite.c...')
#22 /var/www/examplewebsite.co.uk/craft(21): require('/var/www/examplewebsite.c...')
#23 {main}

Any suggestions on what I need to do? I'm on the latest version of CraftCMS and also am using PHP7.2.

Thank you!

  • Just to be sure, you're on the newest craft cms 3, right? Because v2 doesn't have the ./craft file functionality. (Actually, can you just add the craft version which is in the craft's Info.php file into the reply comment? Thanks!) – Campiotti Dec 3 '19 at 10:32
  • @Campiotti Yes I am using Craft CMS 3, the exact version number is Craft CMS 3.3.16.3 – José Veríssimo Dec 3 '19 at 11:26
1

Looks like you have a plugin called core that is not handling console requests properly.

#3 /var/www/examplewebsite.co.uk/vendor/craftcms/cms/src/base/Plugin.php(130): yii\base\Module->__construct('core', Object(craft\console\Application), Array)
|improve this answer|||||
  • Thank you for that suggestion, looks like I was checking a request segment in my custom plugin and there is no request on a console command, makes sense. Commenting out the bit of code sorted it out. – José Veríssimo Dec 3 '19 at 13:16

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.