Drupal-console: [console] Error when running Drupal console inside the site folder

Created on 31 Jan 2017  路  3Comments  路  Source: hechoendrupal/drupal-console

[console] Error when running Drupal console inside the site folder

I can't run Drupal console inside the site folder (I've tried in /vagrant/repos/drupal8 and /vagrant/repos/drupal8/web).

  • Drupal version: 8.2.5
  • Console version: 1.0.0-rc15
  • Console Launcher version: 1.0.0-rc14
  • Steps to reproduce:
    1) Run composer require drupal/console:~1.0 --prefer-dist --optimize-autoloader --sort-packages. I don't get any error and in installed.json drupal/console appear with the following values:
    "name": "drupal/console",
    "version": "1.0.0-rc15",
    2) In /vagrant/repos/drupal8, run vendor/bin/drupal or in /vagrant/repos/drupal8/web run ../vendor/bin/drupal
    3) Then you should get this error:

TypeError: Argument 1 passed to DrupalConsoleCoreUtilsTwigRenderer::__construct() must be an instance of DrupalConsoleCoreUtilsTranslatorManagerInterface, instance of DrupalConsoleUtilsTranslatorManager given in /vagrant/repos/dummysite/vendor/drupal/console-core/src/Utils/TwigRenderer.php on line 43 #0 [internal function]: DrupalConsoleCoreUtilsTwigRenderer->__construct(Object(DrupalConsoleUtilsTranslatorManager), Object(DrupalConsoleCoreUtilsStringConverter))

1 /vagrant/repos/dummysite/vendor/symfony/dependency-injection/ContainerBuilder.php(928): ReflectionClass->newInstanceArgs(Array)

2 /vagrant/repos/dummysite/vendor/symfony/dependency-injection/ContainerBuilder.php(468): SymfonyComponentDependencyInjectionContainerBuilder->createService(Object(SymfonyComponentDependencyInjectionDefinition), 'console.rendere...')

3 /vagrant/repos/dummysite/vendor/drupal/console/src/Bootstrap/Drupal.php(126): SymfonyComponentDependencyInjectionContainerBuilder->get('console.rendere...')

4 /vagrant/repos/dummysite/vendor/drupal/console/bin/drupal.php(49): DrupalConsoleBootstrapDrupal->boot(false)

5 /vagrant/repos/dummysite/vendor/drupal/console/bin/drupal(4): require('/vagrant/repos/...')

6 {main}

TypeError: Argument 1 passed to DrupalConsoleCoreUtilsTwigRenderer::__construct() must be an instance of DrupalConsoleCoreUtilsTranslatorManagerInterface, instance of DrupalConsoleUtilsTranslatorManager given in DrupalConsoleCoreUtilsTwigRenderer->__construct() (line 43 of /vagrant/repos/dummysite/vendor/drupal/console-core/src/Utils/TwigRenderer.php).

Most helpful comment

Hey @guardiola86, I had the exact same error with the same project versions you had except Console launcher version was 1.0.0-rc12. The following steps helped get rid of the error:

  1. Outside of the web root run drupal self-update to update console launcher to the latest rc15 version.
  2. Again outside of the web root run drupal init.

After that I was able to run drupal list in the web root without errors but I struggled long to get there. Hope this helps.

All 3 comments

Hey @guardiola86, I had the exact same error with the same project versions you had except Console launcher version was 1.0.0-rc12. The following steps helped get rid of the error:

  1. Outside of the web root run drupal self-update to update console launcher to the latest rc15 version.
  2. Again outside of the web root run drupal init.

After that I was able to run drupal list in the web root without errors but I struggled long to get there. Hope this helps.

@bruvers thanks for the reply ;)

This is no longer present in the version 1.9.0

Was this page helpful?
0 / 5 - 0 ratings