I took a Drupal project that was created awhile back via downloading a tar file and recreated it on a local via composer with drupal-project.
The recommended files were committed to git (i.e. no contributed modules, etc.) and cloned on the server. The composer install was clean.
At the point of doing a $ drush sqlc
to load the database, it became evident that there was an issue - Drush error message below. I believe the issue is that Drush was already installed.
$ which drush
outputs /home/me/.composer/vendor/bin/drush
.
The error message when I attempt to run drush sqlc
or drush status
from the project, even with --root
, is the following.
PHP Warning: require(/var/www/html/drupal/d8/vendor/composer/../../load.environment.php): failed to open stream: No such file or directory in /var/www/html/drupal/d8/vendor/composer/autoload_real.php on line 70 PHP Stack trace: PHP 1. {main}() /var/www/html/drupal/d8/vendor/drush/drush/drush:0 PHP 2. require() /var/www/html/drupal/d8/vendor/drush/drush/drush:4 PHP 3. include_once() /var/www/html/drupal/d8/vendor/drush/drush/drush.php:56 PHP 4. ComposerAutoloaderInit6220513682b217c143f76d07878222a3::getLoader() /var/www/html/drupal/d8/vendor/autoload.php:7 PHP 5. composerRequire6220513682b217c143f76d07878222a3() /var/www/html/drupal/d8/vendor/composer/autoload_real.php:60 PHP Fatal error: require(): Failed opening required '/var/www/html/drupal/d8/vendor/composer/../../load.environment.php' (include_path='/var/www/html/drupal/d8/vendor/pear/pear_exception:/var/www/html/drupal/d8/vendor/pear/console_getopt:/var/www/html/drupal/d8/vendor/pear/pear-core-minimal/src:/var/www/html/drupal/d8/vendor/pear/archive_tar:.:/usr/share/php') in /var/www/html/drupal/d8/vendor/composer/autoload_real.php on line 70 PHP Stack trace: PHP 1. {main}() /var/www/html/drupal/d8/vendor/drush/drush/drush:0 PHP 2. require() /var/www/html/drupal/d8/vendor/drush/drush/drush:4 PHP 3. include_once() /var/www/html/drupal/d8/vendor/drush/drush/drush.php:56 PHP 4. ComposerAutoloaderInit6220513682b217c143f76d07878222a3::getLoader() /var/www/html/drupal/d8/vendor/autoload.php:7 PHP 5. composerRequire6220513682b217c143f76d07878222a3() /var/www/html/drupal/d8/vendor/composer/autoload_real.php:60
In addition to Drush being in both ~/.composer/vendor
and <root>/vendor
, I note that ~/.composer
contains
autoload.php
composer
phpdocumentor
phpunit
symfony
bin
doctrine
phpspec
sebastian
How do I go about cleaning this up so that the project root is the sole repository of these files and Drush can find what it's looking for?