I am using drush 8.1.2 and drupal 8.1.

I ran composer update in /core as well as in the project root. From what I can see it updates /core/vendor as well as /vendor (in project root).

Obviously this means that many of the libraries are duplicated; I am not sure if this is the idea.

Anyhow, when execute any drush command from /sites/default I get the following error:

Error: Undefined class constant 'Symfony\Component\DependencyInjection\ContainerInterface::SCOPE_CONTAINER' in /myproject/core/lib/Drupal/Core/DependencyInjection/Container.php, line 16

If I open core/lib/Drupal/Core/DependencyInjection/Container.php in my IDE (PHPStorm), the IDE tells me there are multiple definitions for Symfony\Component\DependencyInjection\ContainerInterface, which is fair enough because there is one in core/vendor as well as vendor (in the project root).

Either way, the versions of Symfony\Component\DependencyInjection\ContainerInterface is exactly the same (version 2.8.6)

According to this post, it is important that they are the same, which they are, and the class constant is defined in both files.

I get the impression, the file is not being 'auto-loaded', but I do not know enough about Drupal 8 to figure out if it is or not.

For the record, when I open the project in my browser (hit the web site), it is working fine.

So the drush / drupal boot-strap process is not working.

Any ideas where to start looking please.

  • Just a side note - I installed a clean D8.1 site, and when I execute drush pm-list I get the same error; so the problem is not the fact that I ran composer update on my project. The problem is either in core or drush (I think). – JP Dippenaar May 19 '16 at 6:09

The problem is exactly that you executed composer update twice, in two different directories. You don't execute it from the core directory, but only from the directory containing the core directory. In fact, the composer.json file you find in the directory where you decompressed the Drupal archive contains the following lines.

    "merge-plugin": {
        "include": [
        "recurse": false,
        "replace": false,
        "merge-extra": false

The include part is telling to Composer to include the core/composer.json file too when updating. Supposing that mysite is the directory containing the core directory and the other Drupal files, it is enough you execute the following commands to get in mysite/vendor all the dependencies necessary.

cd mysite
composer update

In my case, I get the following output. (It may change, basing on how often you execute those commands.)

Loading composer repositories with package information
Updating dependencies (including require-dev)
Removing symfony/polyfill-iconv (v1.1.1)
Installing symfony/polyfill-iconv (v1.2.0)
Downloading: 100%

Removing symfony/polyfill-mbstring (v1.1.1)
Installing symfony/polyfill-mbstring (v1.2.0)
Downloading: 100%

Removing symfony/polyfill-php54 (v1.1.1)
Installing symfony/polyfill-php54 (v1.2.0)
Downloading: 100%

Removing symfony/polyfill-php55 (v1.1.1)
Installing symfony/polyfill-php55 (v1.2.0)
Downloading: 100%

Removing guzzlehttp/promises (1.1.0)
Installing guzzlehttp/promises (1.2.0)
Downloading: 100%

Removing symfony/polyfill-apcu (v1.1.1)
Installing symfony/polyfill-apcu (v1.2.0)
Downloading: 100%

Writing lock file
Generating autoload files

Both Drupal 8 and Drush work for me.

drush status

Drupal version : 8.1.1
Site URI : http://default
Database driver : mysql
Database hostname : localhost
Database port :
Database username : database_username
Database name : database_name
Drupal bootstrap : Successful
Drupal user :
Default theme : bartik
Administration theme : seven
PHP configuration : /etc/php.ini
PHP OS : Darwin
Drush script : /usr/local/bin/drush
Drush version : 8.0.5
Drush temp directory : /tmp
Drush configuration :
Drush alias files :
Install profile : standard
Drupal root : /Library/Server/Web/Data/Sites/mysite
Drupal Settings File : sites/default/settings.php
Site path : sites/default
File directory path : sites/default/files
Temporary file directory path : /tmp
Sync config path : sites/default/files/config_WZrobbGFfHIWBRmKDknFVfKgdyG1gKNFLBYcpBlbTZtEarG_rPEixLJFW6faE9yNFTjdkieQbA/sync

As side note, if you need to include the composer.json files modules could have, you can edit the mysite/composer.json file to contain the following lines.

    "merge-plugin": {
        "include": [
        "recurse": false,
        "replace": false,
        "merge-extra": false

Alternatively, you can use the Composer Manager module. I would suggest installing it, if you need to include any dependecy modules could have.

  • thanks @kiamlaluno. I will remember the composer update advice. In my case the problem was drush was installed globally (also via composer) and in my .composer/vendor I had version 3.x of the dependancy-injection library; When I forced that library to ~2, drush started working just fine. – JP Dippenaar May 19 '16 at 8:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.