2

when I try to update Craft via CLI to 3.5.1. I get the following error:

Failed to instantiate component or class "yii\shell\Bootstrap
in /vendor/yiisoft/yii2/di/Container.php:449

Stack trace:
#0 /vendor/yiisoft/yii2/di/Container.php(374): yii\di\Container->getDependencies()
#1 /vendor/yiisoft/yii2/di/Container.php(159): yii\di\Container->build()
#2 /vendor/yiisoft/yii2/BaseYii.php(345): yii\di\Container->get()
#3 /vendor/yiisoft/yii2/base/Application.php(294): yii\BaseYii::createObject()
#4 /vendor/craftcms/cms/src/console/Application.php(72): yii\base\Application->bootstrap()
#5 /vendor/yiisoft/yii2/base/Application.php(273): craft\console\Application->bootstrap()
#6 /vendor/yiisoft/yii2/console/Application.php(124): yii\base\Application->init()
#7 /vendor/craftcms/cms/src/console/Application.php(58): yii\console\Application->init()
#8 /vendor/yiisoft/yii2/base/BaseObject.php(109): craft\console\Application->init()
#9 /vendor/yiisoft/yii2/base/Application.php(206): yii\base\BaseObject->__construct()
#10 /vendor/yiisoft/yii2/console/Application.php(89): yii\base\Application->__construct()
#11 /vendor/craftcms/cms/src/console/Application.php(48): yii\console\Application->__construct()
#12 [internal function]: craft\console\Application->__construct()
#13 /vendor/yiisoft/yii2/di/Container.php(400): ReflectionClass->newInstanceArgs()
#14 /vendor/yiisoft/yii2/di/Container.php(159): yii\di\Container->build()
#15 /vendor/yiisoft/yii2/BaseYii.php(365): yii\di\Container->get()
#16 /vendor/craftcms/cms/bootstrap/bootstrap.php(245): yii\BaseYii::createObject()
#17 /vendor/craftcms/cms/bootstrap/console.php(51): require('/var/www/client...')
#18 /craft(21): require('/var/www/client...')
#19 {main}

does anyone know what to do about it?

3
  • 2
    Try to remove/rename your vendor folder then run composer clearcache then composer install
    – Oli
    Commented Aug 10, 2020 at 9:47
  • @Oli This got me out of a jam. Thanks!
    – JP.
    Commented Oct 8, 2021 at 22:20
  • @Oli 's suggestion helped me when I had a similar error updating via CLI to 3.7.40.1. Thanks! Commented Oct 18, 2022 at 12:29

2 Answers 2

3

This ended up being a bug we were able to work-around on our side via our web service calls.

If you restore your site from a pre-update attempt database backup and composer.json file, then attempt the update again, it should go through fine.

2

I ran into the same issue today with a fairly old project and was able to fix it by rolling back to Composer 1 locally (composer self-update --1), then updating all of the dependencies and reinstalling, then switching back to Composer 2 (composer self-update --2) and running composer install a second time to pick up on any C2-specific changes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.