Implementation using the composer that replaces the old-style installation but problems with legacy drush


I took a Drupal project that was created a while ago by downloading a tar file and recreated it in a place through the composer with drupal-project.

The recommended files were committed to git (that is, without contributed modules, etc.) and were cloned on the server. The composer's installation was clean.

At the point of making a sqlc drush to load the database, it became clear that there was a problem: the drush error message below. I think the problem is that drush was already installed.

which drush Departures /home/me/.composer/vendor/bin/drush.

The error message when I try to run drush sqlc or drush status of the project, even with --root, is as follows.

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 being drush in ~ / .composer / vendor and / vendor, I notice that ~ / .composer contains

autoload.php    composer    phpdocumentor   phpunit     symfony
bin     doctrine    phpspec     sebastian

How do I clean this up so that the root of the project is the only repository of these files and Drush can find what he is looking for?