[console] Uncaught Error: Call to undefined method Drupal\Console\Core\Utils\DrupalFinder::getVendorDir()
Problem/Motivation
Running any drupal console commands results in the following error:
PHP Fatal error: Uncaught Error: Call to undefined method
Drupal\Console\Core\Utils\DrupalFinder::getVendorDir()
in /vagrant/vendor/drupal/console-core/src/Utils/DrupalFinder.php:24
Stack trace:
#0 /vagrant/vendor/drupal/console/bin/drupal.php(37):
Drupal\Console\Core\Utils\DrupalFinder->locateRoot('/var/www/drupal...')
#1 /vagrant/vendor/drupal/console/bin/drupal(4): require('/vagrant/vendor...')
#2 {main}
thrown in /vagrant/vendor/drupal/console-core/src/Utils/DrupalFinder.php on line 24
Fatal error: Uncaught Error: Call to undefined method
Drupal\Console\Core\Utils\DrupalFinder::getVendorDir() in
/vagrant/vendor/drupal/console-core/src/Utils/DrupalFinder.php on line 24
Error: Call to undefined method Drupal\Console\Core\Utils\DrupalFinder::getVendorDir() in
/vagrant/vendor/drupal/console-core/src/Utils/DrupalFinder.php on line 24
Call Stack:
0.0000 350048 1. {main}() /vagrant/vendor/drupal/console/bin/drupal:0
0.0011 363096 2. require('/vagrant/vendor/drupal/console/bin/drupal.php') /vagrant/vendor/drupal/console/bin/drupal:4
0.0461 2202368 3. Drupal\Console\Core\Utils\DrupalFinder->locateRoot() /vagrant/vendor/drupal/console/bin/drupal.php:37
drupal/console 1.0.0-rc19 The Drupal CLI. A tool to generate boilerplate code, interact with and debug Drupal. 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
Running Drupal 8.3.2
It was working fine until running a recent composer update. Now getting this.
A similar thing happened to me. In my case, I reinstalled the DrupalConsole Launcher and it worked after that.
@welly @jmenke You can also try updating the webflo/drupal-finder package by executing
composer require webflo/drupal-finder:^0.3.0
Same problems here, running above command does not fix my situation @jmolivas. Nothing to install or update
Edit: Downgrading to DC rc18 fixes the problem for me.
@nvaken What command did you use to downgrade?
@jmenke What command did you use to reinstall?
Nevermind, I figured it out:
composer require drupal/console:1.0.0-rc18 --prefer-dist --optimize-autoloader
composer update drupal/console --with-dependencies
nvaken @colans which version of webflo/drupal-finder do you have on the site?
@jmolivas : 0.3.0
composer require webflo/drupal-finder:^0.3.0 works for me, and https://github.com/drupal-composer/drupal-project/commit/4df8a592db3740a164f74a2036b42ea6b2b61e52 has updated
@jmolivas 0.3.0 (read from my composer.lock file)
Related to https://github.com/hechoendrupal/drupal-console-core/pull/163
Awesome to wake up in the morning with a fix for my issue! Thanks guys, working well again
Hi @welly could you please elaborate which fix fixed your issue? This for documentation purposes.
@nvaken apologies, I should have stated that. This worked:
composer require webflo/drupal-finder:^0.3.0
I had the same problem. I can also confirm that this works for me.
Works great by updating webflo to ^0.3.0. Thx for the answer
Just experienced same problem when updating a older project from RC17 to RC19, tried the suggested composer require webflo/drupal-finder:^0.3.0 fix, but still nothing happens. The command returns:
$ composer require webflo/drupal-finder:^0.3.0
./composer.json has been updated
Gathering patches for root package.
> DrupalProject\composer\ScriptHandler::checkComposerVersion
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Writing lock file
Generating autoload files
> DrupalProject\composer\ScriptHandler::createRequiredFiles
It does add webflo/drupal-finder to my composer.json, but still nothing happens and DC is unresponsive. :/
So, to summerise; I have both a new and existing setup which have the same problems.
Oh, now I got it working, apparently you also need your launcher on the latest RC19. (I previously had RC18 installed) So, that probably means that if you're experiencing this issue, first check if your launcher is up to date:
$ drupal self-update
Then, if problems persist, make sure you have the latest webflo/drupal-finder:
$ composer require webflo/drupal-finder:^0.3.0
Yes you need the drupal/console:1.0.0-rc19 to work with webflo/drupal-finder:^0.3.0
@ludal74 Well, yeah, otherwise you won't have experienced this error in the first place. 🙂What I'm saying is that you also need the drupal console launcher at RC19 to fix this.
@nvaken Thx for the precison ! I didn't figured tere was this other module drupal console launcher. It's supposed to be an implicit dependency of an other module because I didn't have to upgrade it. But good to know. Thanks again