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

[console] Uncaught Error: Call to undefined method Drupal\Console\Core\Utils\DrupalFinder::getVendorDir()

Open welly opened this issue 9 years ago • 63 comments

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.

welly avatar May 09 '17 15:05 welly

A similar thing happened to me. In my case, I reinstalled the DrupalConsole Launcher and it worked after that.

creaturekind avatar May 09 '17 18:05 creaturekind

@welly @jmenke You can also try updating the webflo/drupal-finder package by executing

composer require webflo/drupal-finder:^0.3.0

jmolivas avatar May 09 '17 18:05 jmolivas

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 avatar May 09 '17 20:05 nvaken

@nvaken What command did you use to downgrade?

@jmenke What command did you use to reinstall?

colans avatar May 09 '17 22:05 colans

Nevermind, I figured it out:

composer require drupal/console:1.0.0-rc18 --prefer-dist --optimize-autoloader
composer update drupal/console --with-dependencies

colans avatar May 09 '17 22:05 colans

nvaken @colans which version of webflo/drupal-finder do you have on the site?

jmolivas avatar May 09 '17 22:05 jmolivas

@jmolivas : 0.3.0

colans avatar May 09 '17 23:05 colans

composer require webflo/drupal-finder:^0.3.0 works for me, and https://github.com/drupal-composer/drupal-project/commit/4df8a592db3740a164f74a2036b42ea6b2b61e52 has updated

xuxucode avatar May 10 '17 00:05 xuxucode

@jmolivas 0.3.0 (read from my composer.lock file)

nvaken avatar May 10 '17 06:05 nvaken

Related to https://github.com/hechoendrupal/drupal-console-core/pull/163

webflo avatar May 10 '17 07:05 webflo

Awesome to wake up in the morning with a fix for my issue! Thanks guys, working well again

welly avatar May 10 '17 09:05 welly

Hi @welly could you please elaborate which fix fixed your issue? This for documentation purposes.

nvaken avatar May 10 '17 09:05 nvaken

@nvaken apologies, I should have stated that. This worked:

composer require webflo/drupal-finder:^0.3.0

welly avatar May 10 '17 09:05 welly

I had the same problem. I can also confirm that this works for me.

michaellenahan avatar May 10 '17 15:05 michaellenahan

Works great by updating webflo to ^0.3.0. Thx for the answer

ludal74 avatar May 11 '17 10:05 ludal74

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.

nvaken avatar May 11 '17 14:05 nvaken

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

nvaken avatar May 11 '17 14:05 nvaken

Yes you need the drupal/console:1.0.0-rc19 to work with webflo/drupal-finder:^0.3.0

ludal74 avatar May 11 '17 14:05 ludal74

@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 avatar May 12 '17 05:05 nvaken

@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

ludal74 avatar May 12 '17 07:05 ludal74