Drupal-console: [console] Error "You have requested a non-existent service "console.configuration_manager" when running drupal command

Created on 24 Apr 2017  路  30Comments  路  Source: hechoendrupal/drupal-console

Issue title

Problem/Motivation

Every command I enter results in the following error:

sumone@sumserver /var/www/sumone/web $ ../vendor/bin/drupal
Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "console.configuration_manager". in /var/www/sumone/vendor/symfony/dependency-injection/ContainerBuilder.php on line 824 
#0 /var/www/sumone/vendor/symfony/dependency-injection/ContainerBuilder.php(464): Symfony\Component\DependencyInjection\ContainerBuilder->getDefinition('console.configu...')
#1 /var/www/sumone/vendor/drupal/console-core/src/Bootstrap/DrupalConsoleCore.php(62): Symfony\Component\DependencyInjection\ContainerBuilder->get('console.configu...')
#2 /var/www/sumone/vendor/drupal/console/src/Bootstrap/Drupal.php(158): Drupal\Console\Core\Bootstrap\DrupalConsoleCore->boot()
#3 /var/www/sumone/vendor/drupal/console/bin/drupal.php(58): Drupal\Console\Bootstrap\Drupal->boot()
#4 /var/www/sumone/vendor/drupal/console/bin/drupal(4): require('/var/www/sumone/...')
#5 {main}
Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "console.configuration_manager". in Symfony\Component\DependencyInjection\ContainerBuilder->getDefinition() (line 824 of /var/www/sumone/vendor/symfony/dependency-injection/ContainerBuilder.php).

Details to include:

drupal/console                        1.0.0-rc17   The Drupal CLI. A tool to generate boilerplate code, interact with and debug Drupal.
drupal/console-core                   1.0.0-rc17   Drupal Console Core
drupal/console-en                     1.0.0-rc17   Drupal Console English Language
drupal/console-extend-plugin          0.4.0        Drupal Console Extend Plugin

How to reproduce

Install composer-drupal-boilerplate, install dependencies and run:

cd web && ../vendor/bin/drupal
missing-update

Most helpful comment

For anyone totally perplexed by this... I chased it for a long time and turned out to be an incorrect conclusion on the part of DrupalFinder as to the vendor directory's location. I had an empty composer.json file present in the web root, however my vendor directory is one level up, per the drupal-project pattern.

All 30 comments

When I run the command in the drupal root I get teh following error:

sumone@sumwhere/var/www/sumone $ drupal --help
TypeError: Argument 5 passed to Drupal\Console\Command\Module\UninstallCommand::__construct() must be an instance of Drupal\Console\Extension\Manager, none given in /var/www/sumone/vendor/drupal/console/src/Command/Module/UninstallCommand.php on line 63 
#0 [internal function]: Drupal\Console\Command\Module\UninstallCommand->__construct(Object(Drupal\Console\Utils\Site), Object(Drupal\Core\ProxyClass\Extension\ModuleInstaller), Object(Drupal\Console\Core\Utils\ChainQueue), Object(Drupal\Core\Config\ConfigFactory))
#1 /var/www/sumone/vendor/symfony/dependency-injection/ContainerBuilder.php(936): ReflectionClass->newInstanceArgs(Array)
#2 /var/www/sumone/vendor/symfony/dependency-injection/ContainerBuilder.php(476): Symfony\Component\DependencyInjection\ContainerBuilder->createService(Object(Symfony\Component\DependencyInjection\Definition), 'module_uninstal...')
#3 /var/www/sumone/vendor/drupal/console/src/Application.php(170): Symfony\Component\DependencyInjection\ContainerBuilder->get('module_uninstal...')
#4 /var/www/sumone/vendor/drupal/console/src/Application.php(41): Drupal\Console\Application->registerCommands()
#5 /var/www/sumone/vendor/symfony/console/Application.php(123): Drupal\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#6 /var/www/sumone/vendor/drupal/console/bin/drupal.php(68): Symfony\Component\Console\Application->run()
#7 /var/www/sumone/vendor/drupal/console/bin/drupal(4): require('/var/www/sumone/...')
#8 {main}
TypeError: Argument 5 passed to Drupal\Console\Command\Module\UninstallCommand::__construct() must be an instance of Drupal\Console\Extension\Manager, none given in Drupal\Console\Command\Module\UninstallCommand->__construct() (line 63 of /var/www/sumone/vendor/drupal/console/src/Command/Module/UninstallCommand.php).

@n1ru4l can you try update to latest RC-17 and after that execute drupal cr command to clear DrupalConsole cache.

@n1ru4l Make sure the launcher is updated as well.

I will try it this week

I am having the same issue as well but with RC19.

drupal/console                        1.0.0-rc19         The Drupal CLI. A tool to ge...
drupal/console-core                   1.0.0-rc19         Drupal Console Core
drupal/console-en                     1.0.0-rc19         Drupal Console English Language
drupal/console-extend-plugin          0.6.0              Drupal Console Extend Plugin

Error:

vagrant@drupalvm:/var/www/drupalvm/drupal/docroot$ ../vendor/bin/drupal cr
Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "console.configuration_manager". in /var/www/drupalvm/drupal/vendor/symfony/dependency-injection/ContainerBuilder.php on line 824 #0 /var/www/drupalvm/drupal/vendor/symfony/dependency-injection/ContainerBuilder.php(464): Symfony\Component\DependencyInjection\ContainerBuilder->getDefinition('console.configu...')
#1 /var/www/drupalvm/drupal/vendor/drupal/console-core/src/Bootstrap/DrupalConsoleCore.php(62): Symfony\Component\DependencyInjection\ContainerBuilder->get('console.configu...')
#2 /var/www/drupalvm/drupal/vendor/drupal/console/src/Bootstrap/Drupal.php(158): Drupal\Console\Core\Bootstrap\DrupalConsoleCore->boot()
#3 /var/www/drupalvm/drupal/vendor/drupal/console/bin/drupal.php(58): Drupal\Console\Bootstrap\Drupal->boot()
#4 /var/www/drupalvm/drupal/vendor/drupal/console/bin/drupal(4): require('/var/www/drupal...')
#5 {main}
Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "console.configuration_manager". in Symfony\Component\DependencyInjection\ContainerBuilder->getDefinition() (line 824 of /var/www/drupalvm/drupal/vendor/symfony/dependency-injection/ContainerBuilder.php).


I posted too soon. I believe my error was that I was in the wrong directory. whoops

I could not check this yet since I do not work with Drupal atm but will update when I am back on the project

I have had this issue today on Lightning when trying generate:module. The error vanished after doing a composer update. The updated packages were:

  - Updating justinrainbow/json-schema (5.2.0 => 5.2.1): Loading from cache
  - Updating composer/composer (1.4.1 => 1.4.2): Loading from cache
  - Updating psy/psysh (v0.8.3 => v0.8.5): Loading from cache

I am using RC19. I guess you have to update psy/psysh to get drupal/console working.

I'm getting the same error on my local (using Docksal). I just updated Console to rc20 and rebuilt the console cache...

~/Sites/depanth2/web [master*]$ ../vendor/bin/drupal cr
Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "console.configuration_manager". in Symfony\Component\DependencyInjection\ContainerBuilder->getDefinition() (line 816 of /Users/michael/Sites/depanth2/vendor/symfony/dependency-injection/ContainerBuilder.php).

I did notice that during the update psy/psysh was updated to v0.8.5, but I did not see anything about justinrainbow/json-schema - in fact, looking at my composer.lock, I don't see any mention of justinrainbow/json-schema.

-mike

I have this same issue. Only on one project though (great on another.)

$ composer show | grep console
drupal/console                           1.0.0-rc20          The Drupal CLI. A tool to generate boilerplate code, interact with and debug Drupal.
drupal/console-core                      1.0.0-rc20          Drupal Console Core
drupal/console-en                        1.0.0-rc20          Drupal Console English Language
drupal/console-extend-plugin             0.6.0               Drupal Console Extend Plugin

And

$ composer show psy/psysh
$ composer show psy/psysh
name     : psy/psysh
descrip. : An interactive shell for modern PHP.
keywords : REPL, console, interactive, shell
versions : * v0.8.5

But I also get this line regardless in web docroot or not

$ ./bin/drupal 
Uncaught PHP Exception LogicException: "The controller must return a response (null given). Did you forget to add a return statement somewhere in your controller?" at /Users/mglaman/Clients/commerceguys/liveperson-register/vendor/symfony/http-kernel/HttpKernel.php line 162

My error message

[ERROR] Class Drupal\Core\DrupalKernel does not exist.

with

PHP Fatal error: Uncaught exception 'Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException' with message 'You have requested a non-existent service "console.configuration_manager".' in /Users/clemens/lib/DrupalConsole/vendor/symfony/dependency-injection/ContainerBuilder.php:824
Stack trace:

We may conclude the Drupal core autoload is not found.

I have

  • git cloned DrupalConsole
  • PHP 5.6.29 (cli) (built: Feb 28 2017 14:02:26)
  • Drupal 8.4.x branch

Checking the Docs for this setup i'm doing it wrong. I could do https://docs.drupalconsole.com/en/getting/composer.html or other install by the other variants as listed on https://github.com/hechoendrupal/drupal-console

There is an old gist to 'contribute' which matches my __git clone__ approach but is old.

https://github.com/hechoendrupal/drupal-console/blob/master/CONTRIBUTING.md should cover this.

I created #3331 to get a better grasp of this puzzle.

For anyone totally perplexed by this... I chased it for a long time and turned out to be an incorrect conclusion on the part of DrupalFinder as to the vendor directory's location. I had an empty composer.json file present in the web root, however my vendor directory is one level up, per the drupal-project pattern.

What fixed something like this for me was to rm -rf vendor/drupal/console and then re-run composer install. Then I immediately did a 'drupal --uri=SITE cr' and then all was well.

Closing this one. Feel free to re-open if still happening after updating to the latest version.

The first time using "../vendor/bin/drupal .." is ok, then the second time comes this issue and still on the next time.

I am okay now. I didn't find the real reason.
I update the vendor files in the core.

Deleting the vendor dir and rerunning composer install worked for me. That made some changes to vendor/composer/installed.json. Before deleting the dir, composer install didn't detect changes.

I run drupal console outsite of Drupal root, passing path to the root like:

$ drupal --root=/var/www/drupal/web/master/docroot/

and it fails with error:

[ERROR] Class Drupal\Core\DrupalKernel does not exist.


PHP Fatal error:  Uncaught Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "console.configuration_manager". in /var/www/drupal/vendor/symfony/dependency-injection/ContainerBuilder.php:975

Fatal error: Uncaught Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "console.configuration_manager". in /var/www/drupal/vendor/symfony/dependency-injection/ContainerBuilder.php on line 975

Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "console.configuration_manager". in /var/www/drupal/vendor/symfony/dependency-injection/ContainerBuilder.php on line 975

Any ideas?

@OnkelTem which version of DrupalConsole per-site and launcher are you using?

I have the same problem, drupal console 1.2 and drupal 8.4

@jmolivas Drupal console 1.1.1, Drupal 8.3.5

Same here, a clone from Drupal project, an install of 8.4.2 and a usage of Drupal console 1.2.0.
Console bootstraps out of an install directory.
If you cd in a web directory of the 8.4.2 installed site, you get the error:

Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "console.configuration_manager". in /data/www/formation/vendor/symfony/dependency-injection/ContainerBuilder.php on line 800 #0 /data/www/formation/vendor/symfony/dependency-injection/ContainerBuilder.php(439): Symfony\Component\DependencyInjection\ContainerBuilder->getDefinition('console.configu...')
#1 /data/www/formation/vendor/drupal/console-core/src/Bootstrap/DrupalConsoleCore.php(64): Symfony\Component\DependencyInjection\ContainerBuilder->get('console.configu...')
#2 /data/www/formation/vendor/drupal/console/src/Bootstrap/Drupal.php(194): Drupal\Console\Core\Bootstrap\DrupalConsoleCore->boot()
#3 /data/www/formation/vendor/drupal/console/bin/drupal.php(78): Drupal\Console\Bootstrap\Drupal->boot()
#4 /data/www/formation/vendor/drupal/console/bin/drupal(4): require('/data/www/forma...')
#5 {main}
Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "console.configuration_manager". in Symfony\Component\DependencyInjection\ContainerBuilder->getDefinition() (line 800 of /data/www/formation/vendor/symfony/dependency-injection/ContainerBuilder.php).

Even after swiping the content of vendor.

@Artusamak make sure you do not have an empty composer.jsonfile at the web directory

Indeed, that is the issue on my local setup. Thank you very much @jmolivas .

Also suddenly getting this error:

htdocs $ ../bin/drupal
Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException:
You have requested a non-existent service "console.configuration_manager".
in vendor/symfony/dependency-injection/ContainerBuilder.php on line 1043

#0 vendor/symfony/dependency-injection/ContainerBuilder.php(610): Symfony\Component\DependencyInjection\ContainerBuilder->getDefinition('console.configu...')
#1 vendor/symfony/dependency-injection/ContainerBuilder.php(588): Symfony\Component\DependencyInjection\ContainerBuilder->doGet('console.configu...', 1)
#2 vendor/drupal/console-core/src/Bootstrap/DrupalConsoleCore.php(79): Symfony\Component\DependencyInjection\ContainerBuilder->get('console.configu...')
#3 vendor/drupal/console/src/Bootstrap/Drupal.php(273): Drupal\Console\Core\Bootstrap\DrupalConsoleCore->boot()
#4 vendor/drupal/console/src/Bootstrap/Drupal.php(225): Drupal\Console\Bootstrap\Drupal->bootDrupalConsoleCore()
#5 vendor/drupal/console/bin/drupal.php(79): Drupal\Console\Bootstrap\Drupal->boot()
#6 vendor/drupal/console/bin/drupal(4): require('/Users/sun/site...')
#7 {main}
Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: 
You have requested a non-existent service "console.configuration_manager".
in Symfony\Component\DependencyInjection\ContainerBuilder->getDefinition() (line 1043 of vendor/symfony/dependency-injection/ContainerBuilder.php).

The error disappears when temporarily renaming the composer.json in the web root:

htdocs $ mv composer.json composer.json~
htdocs $ ../bin/drupal --version
Drupal Console version 1.8.0

However, the composer.json in the web root is not empty and not a mistake and needs to exist.

A workaround appears to be to disable the auto-detection with the --root option, although it sometimes fails with an error depending on how it is invoked:

htdocs $ ../bin/drupal --root=`dirname $PWD` --version
Drupal Console version 1.8.0

 [ERROR] The "htdocs/vendor/drupal/console//config/services" directory does not exist. 

Any clues?

Hello,
what about your composer.json ?
if your composer root and your drupal root are not the same directories, then check those two points:

  • be sure not to have a composer.json in drupal root directory. If you have one, Drupalfinder will open it and parse it..
  • be sure to have an "installer-paths" section in the extra section of your composer.json, and specify a target path for the package "drupal/core" or for packages of "type:drupal-core"

Caused for me by an empty composer.json in the Drupal root. Deleting the 'composer.json' fixed it.

What @whereisaaron comment about deleting the empty composer.json from the web/ folder also fixed the issue.

Issue with composer.json in docroot folder is not related to empty, even if working composer.json - drupal console is failing

Was this page helpful?
0 / 5 - 0 ratings