Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
(I'm actually using 4.0.0-alpha4 but I don't see that as an option in the issue fields.)
It seems that Drupal Console is actually required despite just being a dev dependency. Attempting to load the site without it installed showed:
Error: Trait 'Drupal\Console\Command\Shared\ConfirmationTrait' not found in /var/www/docroot/profiles/contrib/lightning/src/Command/SubProfileCommand.php, line 29
Here's the full call stack:
Array
(
[0] => Array
(
[file] => phar:///usr/local/bin/drush/vendor/composer/ClassLoader.php
[line] => 444
[function] => include
)
[1] => Array
(
[file] => phar:///usr/local/bin/drush/vendor/composer/ClassLoader.php
[line] => 322
[function] => Composer\Autoload\includeFile
)
[2] => Array
(
[function] => loadClass
[class] => Composer\Autoload\ClassLoader
[type] => ->
)
[3] => Array
(
[function] => spl_autoload_call
)
[4] => Array
(
[file] => /var/www/vendor/symfony/dependency-injection/ContainerBuilder.php
[line] => 371
[function] => __construct
[class] => ReflectionClass
[type] => ->
)
[5] => Array
(
[file] => /var/www/vendor/symfony/dependency-injection/Compiler/AutowirePass.php
[line] => 363
[function] => getReflectionClass
[class] => Symfony\Component\DependencyInjection\ContainerBuilder
[type] => ->
)
[6] => Array
(
[file] => /var/www/vendor/symfony/dependency-injection/Compiler/AutowirePass.php
[line] => 336
[function] => populateAvailableType
[class] => Symfony\Component\DependencyInjection\Compiler\AutowirePass
[type] => ->
)
[7] => Array
(
[file] => /var/www/vendor/symfony/dependency-injection/Compiler/AutowirePass.php
[line] => 292
[function] => populateAvailableTypes
[class] => Symfony\Component\DependencyInjection\Compiler\AutowirePass
[type] => ->
)
[8] => Array
(
[file] => /var/www/vendor/symfony/dependency-injection/Compiler/AutowirePass.php
[line] => 248
[function] => getAutowiredReference
[class] => Symfony\Component\DependencyInjection\Compiler\AutowirePass
[type] => ->
)
[9] => Array
(
[file] => /var/www/vendor/symfony/dependency-injection/Compiler/AutowirePass.php
[line] => 187
[function] => autowireMethod
[class] => Symfony\Component\DependencyInjection\Compiler\AutowirePass
[type] => ->
)
[10] => Array
(
[file] => /var/www/vendor/symfony/dependency-injection/Compiler/AutowirePass.php
[line] => 153
[function] => autowireCalls
[class] => Symfony\Component\DependencyInjection\Compiler\AutowirePass
[type] => ->
)
[11] => Array
(
[file] => /var/www/vendor/symfony/dependency-injection/Compiler/AutowirePass.php
[line] => 109
[function] => doProcessValue
[class] => Symfony\Component\DependencyInjection\Compiler\AutowirePass
[type] => ->
)
[12] => Array
(
[file] => /var/www/vendor/symfony/dependency-injection/Compiler/AbstractRecursivePass.php
[line] => 60
[function] => processValue
[class] => Symfony\Component\DependencyInjection\Compiler\AutowirePass
[type] => ->
)
[13] => Array
(
[file] => /var/www/vendor/symfony/dependency-injection/Compiler/AutowirePass.php
[line] => 130
[function] => processValue
[class] => Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass
[type] => ->
)
[14] => Array
(
[file] => /var/www/vendor/symfony/dependency-injection/Compiler/AutowirePass.php
[line] => 109
[function] => doProcessValue
[class] => Symfony\Component\DependencyInjection\Compiler\AutowirePass
[type] => ->
)
[15] => Array
(
[file] => /var/www/vendor/symfony/dependency-injection/Compiler/AbstractRecursivePass.php
[line] => 39
[function] => processValue
[class] => Symfony\Component\DependencyInjection\Compiler\AutowirePass
[type] => ->
)
[16] => Array
(
[file] => /var/www/vendor/symfony/dependency-injection/Compiler/AutowirePass.php
[line] => 70
[function] => process
[class] => Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass
[type] => ->
)
[17] => Array
(
[file] => /var/www/vendor/symfony/dependency-injection/Compiler/Compiler.php
[line] => 141
[function] => process
[class] => Symfony\Component\DependencyInjection\Compiler\AutowirePass
[type] => ->
)
[18] => Array
(
[file] => /var/www/vendor/symfony/dependency-injection/ContainerBuilder.php
[line] => 788
[function] => compile
[class] => Symfony\Component\DependencyInjection\Compiler\Compiler
[type] => ->
)
[19] => Array
(
[file] => /var/www/docroot/core/lib/Drupal/Core/DrupalKernel.php
[line] => 1318
[function] => compile
[class] => Symfony\Component\DependencyInjection\ContainerBuilder
[type] => ->
)
[20] => Array
(
[file] => /var/www/docroot/core/lib/Drupal/Core/DrupalKernel.php
[line] => 892
[function] => compileContainer
[class] => Drupal\Core\DrupalKernel
[type] => ->
)
[21] => Array
(
[file] => /var/www/docroot/core/lib/Drupal/Core/DrupalKernel.php
[line] => 468
[function] => initializeContainer
[class] => Drupal\Core\DrupalKernel
[type] => ->
)
[22] => Array
(
[file] => /var/www/docroot/core/lib/Drupal/Core/DrupalKernel.php
[line] => 717
[function] => boot
[class] => Drupal\Core\DrupalKernel
[type] => ->
)
[23] => Array
(
[file] => /var/www/docroot/core/includes/utility.inc
[line] => 43
[function] => prepareLegacyRequest
[class] => Drupal\Core\DrupalKernel
[type] => ->
)
So it seems composer is including SubProfileCommand.php which has lots of `use` statements for Console, which then throws errors, even though I'm just trying to load the site.
Comment | File | Size | Author |
---|---|---|---|
#10 | 3007425-lightning-core-console-fix.patch | 828 bytes | bkosborne |
Comments
Comment #2
bkosborneI ran into something similar when trying to run a drush cache rebuild on a dev site:
Comment #3
bendeguz.csirmaz CreditAttribution: bendeguz.csirmaz at Cheppers commentedI could not reproduce this error, Lightning 4.0.0-alpha4 installed and loaded without errors.
Could you write down the exact steps to reproduce, please?
Comment #4
phenaproximaComment #5
feilauren CreditAttribution: feilauren as a volunteer commentedI ran into this issue yesterday. It was resolved by adding drupal/console to the composer.json file in my project root. It looks like it used to exist as a dev requirement in the Lightning profile's Composer file but has been removed, which means that the patches made to fix this by moving it from a dev requirement up to a general requirement no longer work.
I did not test this solution but here is a similar issue, with patch:
https://www.drupal.org/project/lightning/issues/2955286
When attempting to install drupal/console, however, I ran into some aggressive conflicts, as seen here: https://github.com/hechoendrupal/drupal-console/issues/3885
This was resolved by deleting my vendor directory and lock file. Once that was working, the final problem is that the modules that I had attempted to install that triggered this issue in the first place were only partially installed. I removed them from Composer, installed, cleared caches, added back, re-enabled and it worked.
Comment #6
maticb CreditAttribution: maticb commentedI ran into the same issue, it happened when trying to install a new module (media_pdf_thumbnail) it kept failing on UpdateCommand.php. As #5 I also had to remove vendor and composer.lock, then add drupal/console as core dependency and run drush en media_pdf_thumbnail after that.
I think the actual module I was installing here is irrelevant though.
Comment #7
bkosborneRan into this again today. Not sure what exactly triggered it to happen. Not sure how I fixed this 9 months ago :)
For me it happens in local dev environment when running a drush cache clear (of drush cache):
Comment #8
phenaproximaI think I know why this is happening. I suspect that it's because Lightning Core exposes the command in its normal *.services.yml file, rather than console.services.yml.
Try moving the command's service definition into console.services.yml. If it works, post a patch and I will commit it :)
Comment #9
bkosborneYea, that's it I think. I made that change locally and got past the error.
Comment #10
bkosborneComment #11
phenaproximaPerfect. Thanks, @bkosborne! I also tested this locally and confirmed this works, so it's RTBC. Assuming tests pass on CI, I will commit it.
Comment #12
bkosborneI'm on Lightning 4.2 at the moment, so here's a version of the patch that applies there. I'll hide the file though to not confuse others. Need it on d.o. for our devops workflow.
Comment #13
phenaproximaCommitted to Lightning Core 8.x-4.x and cherry-picked to 8.x-3.x. Thanks!