DDev- upgrade D9.5>D10 Drush not working

Created on 14 January 2024, 11 months ago
Updated 28 July 2024, 5 months ago

Problem

After upgrade with no errors as instructed on: https://www.drupal.org/docs/upgrading-drupal/upgrading-from-drupal-8-or-... โ†’ , got error when trying to ddev drush updatedb:

 [preflight] The alias  references a Drupal site that does not contain its own copy of Drush. Please add Drush to this site to use it.
Failed to run drush version: exit status 1

In my website got error:

Warning: class_implements(): Class Drupal\Core\Entity\EntityBundleAccessCheck does not exist and could not be loaded in Drupal\Core\DependencyInjection\Compiler\RegisterAccessChecksPass->process() (line 43 of /var/www/html/vendor/drupal/core/lib/Drupal/Core/DependencyInjection/Compiler/RegisterAccessChecksPass.php).
Additional uncaught exception thrown while handling exception.
Original
TypeError: in_array(): Argument #2 ($haystack) must be of type array, bool given in in_array() (line 43 of /var/www/html/vendor/drupal/core/lib/Drupal/Core/DependencyInjection/Compiler/RegisterAccessChecksPass.php).

in_array('Drupal\Core\Access\AccessCheckInterface', , 1) (Line: 43)
Drupal\Core\DependencyInjection\Compiler\RegisterAccessChecksPass->process(Object) (Line: 80)
Symfony\Component\DependencyInjection\Compiler\Compiler->compile(Object) (Line: 767)
Symfony\Component\DependencyInjection\ContainerBuilder->compile() (Line: 1330)
Drupal\Core\DrupalKernel->compileContainer() (Line: 934)
Drupal\Core\DrupalKernel->initializeContainer() (Line: 20)
Drupal\Core\Installer\InstallerKernel->initializeContainer() (Line: 494)
Drupal\Core\DrupalKernel->boot() (Line: 426)
install_begin_request(Object, Array) (Line: 116)
install_drupal(Object) (Line: 48)
Additional
Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "theme.manager". in Symfony\Component\DependencyInjection\ContainerBuilder->getDefinition() (line 992 of /var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php).

Symfony\Component\DependencyInjection\ContainerBuilder->getDefinition('theme.manager') (Line: 568)
Symfony\Component\DependencyInjection\ContainerBuilder->doGet('theme.manager', 1) (Line: 531)
Symfony\Component\DependencyInjection\ContainerBuilder->get('theme.manager') (Line: 649)
Drupal::theme() (Line: 22)
_drupal_maintenance_theme() (Line: 322)
drupal_maintenance_theme() (Line: 1025)
install_display_output(Array, Array) (Line: 271)
_drupal_log_error(Array, 1) (Line: 182)
_drupal_exception_handler(Object)

Composer.json:

{
    "name": "drupal-composer/drupal-project",
    "description": "Project template for Drupal 8 projects with composer",
    "type": "project",
    "license": "GPL-2.0-or-later",
    "authors": [
        {
            "name": "",
            "role": ""
        }
    ],
    "repositories": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        }
    ],
    "require": {
        "php": ">=7.0.8",
        "cweagans/composer-patches": "^1.7",
        "drupal/antibot": "^2.0",
        "drupal/components": "^3.0@beta",
        "drupal/core-composer-scaffold": "^10",
        "drupal/core-dev": "^10",
        "drupal/core-project-message": "^10",
        "drupal/core-recommended": "^10",
        "drupal/fontawesome": "^2.15",
        "drupal/honeypot": "^2.0.2",
        "drupal/radix": "^4.10",
        "drupal/smtp": "^1.2",
        "drupal/views_bootstrap": "^4.2",
        "drupal/webform": "^6.0",
        "drush/drush": "^12.4",
        "vlucas/phpdotenv": "^4.0",
        "webflo/drupal-finder": "^1.0.0",
        "zaporylie/composer-drupal-optimizations": "^1.0"
    },
    "conflict": {
        "drupal/drupal": "*"
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "config": {
        "sort-packages": true,
        "allow-plugins": {
            "composer/installers": true,
            "dealerdirect/phpcodesniffer-composer-installer": true,
            "drupal/console-extend-plugin": true,
            "cweagans/composer-patches": true,
            "drupal/core-composer-scaffold": true,
            "drupal/core-project-message": true,
            "zaporylie/composer-drupal-optimizations": true,
            "php-http/discovery": true,
            "phpstan/extension-installer": true
        }
    },
    "autoload": {
        "classmap": [
            "scripts/composer/ScriptHandler.php"
        ],
        "files": ["load.environment.php"]
    },
    "scripts": {
        "pre-install-cmd": [
            "DrupalProject\\composer\\ScriptHandler::checkComposerVersion"
        ],
        "pre-update-cmd": [
            "DrupalProject\\composer\\ScriptHandler::checkComposerVersion"
        ],
        "post-install-cmd": [
            "DrupalProject\\composer\\ScriptHandler::createRequiredFiles"
        ],
        "post-update-cmd": [
            "DrupalProject\\composer\\ScriptHandler::createRequiredFiles"
        ]
    },
    "extra": {
        "composer-exit-on-patch-failure": true,
        "patchLevel": {
            "drupal/core": "-p2"
        },
        "drupal-scaffold": {
            "locations": {
                "web-root": "web/"
            }
        },
        "installer-paths": {
            "web/core": ["type:drupal-core"],
            "web/libraries/{$name}": ["type:drupal-library"],
            "web/modules/contrib/{$name}": ["type:drupal-module"],
            "web/profiles/contrib/{$name}": ["type:drupal-profile"],
            "web/themes/contrib/{$name}": ["type:drupal-theme"],
            "drush/Commands/contrib/{$name}": ["type:drupal-drush"]
        }
    }
}

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

๐Ÿ’ฌ Support request
Status

Closed: outdated

Version

11.0 ๐Ÿ”ฅ

Component
Database updateย  โ†’

Last updated 3 days ago

No maintainer
Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Issue created by @zkristof
  • This looks like a duplicate and you should peruse the other issue.

    Some code on the site is not compatible with Drupal 10. Did you run the upgrade readiness report? Anyway, as with every case like this, searching the code base for the missing things, like โ€œtheme.managerโ€, will turn up the incompatible code.

  • And for the Drush error you should do what it says and you should execute drush in vendor/bin/drush. Global Drush is not supported.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States caspervoogt

    I have run into this too, and in my case it was due to my Composer not being able to run Composer plugins within Docker, due to this Docker error "Composer plugins have been disabled for safety in this non-interactive session. Set COMPOSER_ALLOW_SUPERUSER=1 if you want to allow plugins to run as root/super user". So at least in some cases it could be Composer plugin related. This is new since Docker 2.4.2 (discussed here). Adding "COMPOSER_ALLOW_SUPERUSER=1" to my Dockerfile solved the issue for me.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States vlyalko

    My drupal core version: 10.2.2
    Drush version: 12.4.3.0
    This combination is successfully working in prod now.
    Any new deployment to DEV branch results in the same error as above:

    [preflight] The alias references a Drupal site that does not contain its own copy of Drush. Please add Drush to this site to use it.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States vlyalko

    @caspervoogt, THANK YOU! Adding "COMPOSER_ALLOW_SUPERUSER=1" to my Dockerfile solved the issue for me too.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States caspervoogt

    @vlyalko you're welcome! Took quite some detective work to figure out

  • ๐Ÿ‡บ๐Ÿ‡ฆUkraine MatweyK

    Faced the same error with non-docker setup, non multi-siting.

    My Drupal core version: 10.2.2
    Drush version: 12.4.3.0
    Composer version: 2.7.1
    AWS ELB

    Setting "COMPOSER_ALLOW_SUPERUSER=1" env variable fixed the issue as well in my case.
    another option is to downgrade composer to 2.6.6.

    Seems the root cause coming from composer 2.7.0 upgrade
    Plugins not being loaded -> https://github.com/composer/composer/issues/11839

  • Status changed to Closed: outdated 5 months ago
Production build 0.71.5 2024