drupal-console icon indicating copy to clipboard operation
drupal-console copied to clipboard

Does not work with Drupal Composer Project

Open ArtuGit opened this issue 9 years ago • 25 comments

I use 'drupal-composer/drupal-project'.

I perform 'drupal' inside a website folder and I have:

Recoverable fatal error: Argument 1 passed to Drupal\Console\Command\Site\DebugCommand::__construct() must be an instance of Drupal\Console\Utils\ConfigurationManager, instance of Drupal\Console\Utils\Site given in phar:///usr/local/bin/drupal/vendor/drupal/console-core/src/Command/Site/DebugCommand.php on line 39 #0 /var/www/drupalvm/mysite/web/core/includes/bootstrap.inc(548): _drupal_error_handler_real(4096, 'Argument 1 pass...', 'phar:///usr/loc...', 39, Array)
#1 phar:///usr/local/bin/drupal/vendor/drupal/console-core/src/Command/Site/DebugCommand.php(39): _drupal_error_handler(4096, 'Argument 1 pass...', 'phar:///usr/loc...', 39, Array)
#2 [internal function]: Drupal\Console\Command\Site\DebugCommand->__construct(Object(Drupal\Console\Utils\Site), Object(Drupal\Console\Utils\ConfigurationManager))
#3 phar:///usr/local/bin/drupal/vendor/symfony/dependency-injection/ContainerBuilder.php(928): ReflectionClass->newInstanceArgs(Array)
#4 phar:///usr/local/bin/drupal/vendor/symfony/dependency-injection/ContainerBuilder.php(468): Symfony\Component\DependencyInjection\ContainerBuilder->createService(Object(Symfony\Component\DependencyInjection\Definition), 'console.site_de...')
#5 /var/www/drupalvm/mysite/vendor/drupal/console/src/Application.php(143): Symfony\Component\DependencyInjection\ContainerBuilder->get('console.site_de...')
#6 /var/www/drupalvm/mysite/vendor/drupal/console/src/Application.php(38): Drupal\Console\Application->registerCommands()
#7 phar:///usr/local/bin/drupal/vendor/symfony/console/Application.php(124): Drupal\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 /var/www/drupalvm/mysite/vendor/drupal/console/bin/drupal.php(70): Symfony\Component\Console\Application->run()
#9 phar:///usr/local/bin/drupal/src/Utils/Launcher.php(28): include_once('/var/www/drupal...')
#10 phar:///usr/local/bin/drupal/bin/drupal.php(87): Drupal\Console\Utils\Launcher->launch('/var/www/drupal...')
#11 phar:///usr/local/bin/drupal/bin/drupal(3): require('phar:///usr/loc...')
#12 /usr/local/bin/drupal(10): require('phar:///usr/loc...')
#13 {main}
Recoverable fatal error: Argument 1 passed to Drupal\Console\Command\Site\DebugCommand::__construct() must be an instance of Drupal\Console\Utils\ConfigurationManager, instance of Drupal\Console\Utils\Site given in Drupal\Console\Command\Site\DebugCommand->__construct() (line 39 of phar:///usr/local/bin/drupal/vendor/drupal/console-core/src/Command/Site/DebugCommand.php).

What is the problem?

ArtuGit avatar Jan 01 '17 10:01 ArtuGit

@ArtuGit which version of the project do you have installed?

jmolivas avatar Jan 02 '17 20:01 jmolivas

@ArtuGit can you confirm you are using DC RC12 on the site and the launcher?

jmolivas avatar Jan 02 '17 21:01 jmolivas

@jmolivas Yes, Drupal Console Launcher version 1.0.0-rc12

ArtuGit avatar Jan 02 '17 22:01 ArtuGit

And "drupal/console": "~1.0" in the composer.json (of the Drupal Composer Project)

ArtuGit avatar Jan 02 '17 22:01 ArtuGit

try executing within your site then copy/paste results please

 composer show | grep drupal/console

jmolivas avatar Jan 02 '17 22:01 jmolivas

drupal/console 1.0.0-rc10 The Drupal CLI. A tool to generate b... drupal/console-core 1.0.0-rc10 Drupal Console Core drupal/console-en 1.0.0-rc9 Drupal Console English Language

ArtuGit avatar Jan 02 '17 22:01 ArtuGit

Try updating executing:

composer update drupal/console 

jmolivas avatar Jan 02 '17 22:01 jmolivas

Now I have drupal/console 1.0.0-rc11 and a message:

[Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException]  
You have requested a non-existent service "console.chain_discovery".        

ArtuGit avatar Jan 03 '17 10:01 ArtuGit

@ArtuGit can you try updating both (site and launcher) to latest RC-13

jmolivas avatar Jan 03 '17 18:01 jmolivas

How can I do it correctly (for the both)?

ArtuGit avatar Jan 03 '17 20:01 ArtuGit

@ArtuGit https://gist.github.com/jmolivas/a0970e1ea252ecb852fe8c7182d85d3e

jmolivas avatar Jan 03 '17 20:01 jmolivas

@jmolivas, thanks.

After 'drupal self-update' I have: [OK] Updated from version "1.0.0-rc12" to version "1.0.0-rc13".

When I perform 'drupal' inside the website folder I have:

PHP Fatal error:  Trait 'Drupal\Console\Command\Shared\InputTrait' not found in /var/www/drupalvm/mysite/vendor/drupal/console/src/Command/Generate/ControllerCommand.php on line 32

Fatal error: Trait 'Drupal\Console\Command\Shared\InputTrait' not found in /var/www/drupalvm/mysite/vendor/drupal/console/src/Command/Generate/ControllerCommand.php on line 32

((

ArtuGit avatar Jan 03 '17 22:01 ArtuGit

@ArtuGit did you updated DC within the site too? execute this form the site root and copy/paste the output.

 composer show | grep drupal/console

jmolivas avatar Jan 04 '17 01:01 jmolivas

@jmolivas There is 'Nothing to install or update". Currently, I still have:

drupal/console 1.0.0-rc11 The Drupal CLI. A tool to generate boilerplate code... drupal/console-core 1.0.0-rc10 Drupal Console Core drupal/console-en 1.0.0-rc9 Drupal Console English Language

ArtuGit avatar Jan 04 '17 10:01 ArtuGit

@ArtuGit Latest release is RC-13 not sure why executing form your site root composer update drupal/console or composer update drupal/console --with-dependencies does not update your site. Maybe you have a fixed version presented at your composer.json file

jmolivas avatar Jan 04 '17 11:01 jmolivas

update drupal/console --with-dependencies works and now drupal works too! Thank you a lot. ))

drupal/console 1.0.0-rc13 The Drupal CLI. A tool to generate boilerplate c... drupal/console-core 1.0.0-rc13 Drupal Console Core drupal/console-en 1.0.0-rc13 Drupal Console English Language

ArtuGit avatar Jan 04 '17 11:01 ArtuGit

Hi, I am getting this error

Fatal error: Cannot use Drupal\Console\Core\Bootstrap\DrupalConsoleCore as DrupalConsoleCore because the name is already in use

with

drupal/console 1.0.0-rc16 drupal/console-core 1.0.0-rc16 drupal/console-en 1.0.0-rc16

mmwebaze avatar Mar 04 '17 06:03 mmwebaze

@mmwebaze what are your OS and PHP versions?

jmolivas avatar Mar 04 '17 20:03 jmolivas

@jmolivas thanks I was able to finally resolve the issue.

mmwebaze avatar Mar 04 '17 23:03 mmwebaze

@mmwebaze do you mind to share how did you fix it?

jmolivas avatar Mar 05 '17 04:03 jmolivas