2

I just upgraded our site from Drupal 9.5.9 to Drupal 10.1 (following instructions from here - https://www.drupal.org/docs/upgrading-drupal/upgrading-from-drupal-8-or-later/upgrading-a-composer-based-site).

Upon launching the site right after I received these errors

The website encountered an unexpected error. Please try again later.

Drupal\Component\Plugin\Exception\PluginNotFoundException: The "node_type" plugin does not exist. Valid plugin IDs for Drupal\rules\Core\ConditionManager are: gtag_domain, gtag_language, language, rules_entity_is_of_type, rules_entity_field_access, rules_entity_is_of_bundle, rules_ip_is_banned, rules_list_count_is, rules_path_has_alias, rules_user_has_role, rules_data_comparison, rules_node_is_of_type, rules_entity_has_field, rules_user_is_blocked, rules_text_comparison, rules_entity_is_new, rules_node_is_promoted, rules_path_alias_exists, rules_node_is_published, rules_list_contains, rules_data_is_empty, rules_node_is_sticky, current_theme, request_path, user_role, webform, entity_bundle:block_content, entity_bundle:crop, entity_bundle:entity_subqueue, entity_bundle:media, entity_bundle:node, entity_bundle:redirect, entity_bundle:shortcut, entity_bundle:taxonomy_term, entity_bundle:webform_submission, entity_bundle:menu_link_content, entity_bundle:paragraph in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 53 of core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php).

I recognize that this error (and similar issues) have been reported on this forum and I have tried all the suggested fixes but it still reports failures. Here's what I have tried.

I understand the error is b/c node_type is deprecated and removed in Drupal 10, and instead it should be replaced with entity_bundle:node. So I exported all my configuration from the upgraded env (using drush config-export). I found two .yml configuration files that were using node_type in its conditions. I started by replacing just one of those two files as below

BEFORE

...
conditions:
  node_type:
    id: node_type
...

AFTER

...
conditions:
  'entity_bundle:node':
    id: 'entity_bundle:node' 
...

Cleared the cache and tried to import just this updated config yml file (using drush config-import --partial <path_to_dir_w_updated_config) as a test to see if the change might help resolve the initial errors. But I received the below error on running the config-import

+------------+--------------------------+-----------+
| Collection | Config                   | Operation |
+------------+--------------------------+-----------+
|            | asset_injector.css.media | Update    |
+------------+--------------------------+-----------+
PHP Fatal error:  Declaration of Drush\Style\DrushStyle::warning(array|string $message) must be compatible with Symfony\Component\Console\Style\SymfonyStyle::warning($message) in <site_root>/vendor/drush/drush/src-symfony-compatibility/v6/Style/DrushStyle.php on line 35

I am not sure what is causing the valid plugin type of entity_bundle:node to not be accepted. Any help is appreciated.

Here are my Symfony and Drush version info at present -

% composer show | grep symfony
symfony/console                           v5.4.3   
symfony/dependency-injection              v6.0.3   
symfony/deprecation-contracts             v3.0.0   
symfony/error-handler                     v6.0.3   
symfony/event-dispatcher                  v6.0.3   
symfony/event-dispatcher-contracts        v3.0.0   
symfony/filesystem                        v6.3.1   
symfony/finder                            v6.3.3   
symfony/http-foundation                   v6.0.3   
symfony/http-kernel                       v6.0.4   
symfony/mime                              v6.0.3   
symfony/polyfill-ctype                    v1.24.0  
symfony/polyfill-iconv                    v1.24.0  
symfony/polyfill-intl-grapheme            v1.24.0  
symfony/polyfill-intl-idn                 v1.24.0  
symfony/polyfill-intl-normalizer          v1.24.0  
symfony/polyfill-mbstring                 v1.24.0  
symfony/polyfill-php72                    v1.27.0  
symfony/polyfill-php73                    v1.27.0  
symfony/polyfill-php80                    v1.24.0  
symfony/polyfill-php81                    v1.24.0  
symfony/process                           v6.0.3   
symfony/psr-http-message-bridge           v2.1.2   
symfony/routing                           v6.0.3   
symfony/serializer                        v6.0.3   
symfony/service-contracts                 v3.0.0   
symfony/string                            v6.0.3   
symfony/translation-contracts             v3.0.0   
symfony/validator                         v6.0.3   
symfony/var-dumper                        v6.0.3   
symfony/yaml                              v6.0.3   

% composer show | grep drush
drush/drush                               11.6.0 

Edit - My composer.json

{
    "name": "pantheon-upstreams/drupal-project",
    "description": "Install Drupal 9 with Composer on Pantheon.",
    "type": "project",
    "license": "MIT",
    "dev notes": [
        "Entityqueue locked at 8.x-1.0-beta5 due to fatal error on /our-focus.",
        "switch_page_theme is on dev release for d9 compatibility"
    ],
    "repositories": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        },
        {
            "type": "path",
            "url": "upstream-configuration"
        }
    ],
    "require": {
        "chi-teck/drupal-code-generator": "^2.6",
        "drupal/admin_toolbar": "^3.3",
        "drupal/advagg": "^6.0@alpha",
        "drupal/asset_injector": "^2.16",
        "drupal/better_exposed_filters": "^6.0",
        "drupal/block_class": "^2.0",
        "drupal/block_field": "^1.0@RC",
        "drupal/captcha": "^1.9",
        "drupal/chosen": "^3.0",
        "drupal/color_field": "^3.0",
        "drupal/conditional_fields": "^4.0@alpha",
        "drupal/core-composer-scaffold": "^10",
        "drupal/core-project-message": "^10",
        "drupal/core-recommended": "^10",
        "drupal/crop": "^2.3",
        "drupal/ctools": "^3.13",
        "drupal/devel": "^5.1",
        "drupal/embed": "^1.6",
        "drupal/entity_reference_revisions": "^1.10",
        "drupal/entity_usage": "^2.0@beta",
        "drupal/entityqueue": "^1.6",
        "drupal/eu_cookie_compliance": "^1.24",
        "drupal/field_group": "^3.4",
        "drupal/filebrowser": "^3.1@RC",
        "drupal/flexslider": "2.x-dev@dev",
        "drupal/focal_point": "^2.0@alpha",
        "drupal/formblock": "^2.0@beta",
        "drupal/google_analytics": "^4.0",
        "drupal/google_tag": "^1.6",
        "drupal/imce": "^3.0",
        "drupal/jquery_ui": "^1.6",
        "drupal/jquery_ui_accordion": "^2.0",
        "drupal/jquery_ui_datepicker": "^2.0",
        "drupal/jquery_ui_slider": "^2.0.0",
        "drupal/jquery_ui_touch_punch": "^1.0",
        "drupal/language_switcher_extended": "^1.1",
        "drupal/libraries": "^4.0",
        "drupal/menu_link_attributes": "^1.3",
        "drupal/metatag": "^1.22",
        "drupal/node_revision_delete": "^2.0@alpha",
        "drupal/pantheon_advanced_page_cache": "^2.1",
        "drupal/paragraphs": "^1.15",
        "drupal/pathauto": "^1.11",
        "drupal/permissions_by_term": "^3.1",
        "drupal/quick_node_clone": "^1.16",
        "drupal/recaptcha": "^3.1",
        "drupal/redirect": "^1.8",
        "drupal/redirect_after_login": "2.x-dev@dev",
        "drupal/redis": "^1.6",
        "drupal/registration_role": "^2.0",
        "drupal/rules": "3.x-dev@dev",
        "drupal/search404": "^2.1",
        "drupal/smart_trim": "^2.0",
        "drupal/smtp": "^1.2",
        "drupal/stable": "^2.0",
        "drupal/svg_formatter": "^2.0",
        "drupal/switch_page_theme": "^4.0",
        "drupal/tac_lite": "1.x-dev@dev",
        "drupal/taxonomy_multidelete_terms": "^1.3",
        "drupal/token": "^1.11",
        "drupal/toolbar_menu": "^3.0",
        "drupal/twig_field_value": "^2.0",
        "drupal/twig_tweak": "^3.2",
        "drupal/typed_data": "^1.0@beta",
        "drupal/upgrade_status": "^4.0",
        "drupal/url_embed": "^2.0@alpha",
        "drupal/video_embed_field": "^2.5",
        "drupal/views_conditional": "^1.5",
        "drupal/views_field_view": "^1.0@beta",
        "drupal/views_infinite_scroll": "^2.0",
        "drupal/views_slideshow": "^5.0",
        "drupal/viewsreference": "^2.0@beta",
        "drupal/webform": "^6.2@beta",
        "drupal/webp": "^1.0@beta",
        "drupal/xmlsitemap": "^1.4",
        "drupal/zurb_foundation": "^9.0@beta",
        "drush/drush": "^11.5",
        "mglaman/composer-drupal-lenient": "^1.0",
        "pantheon-upstreams/upstream-configuration": "*",
        "phpstan/extension-installer": "*",
        "topfloor/composer-cleanup-vcs-dirs": "^1.1"
    },
    "conflict": {
        "drupal/drupal": "*"
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "extra": {
        "installer-paths": {
            "web/core": [
                "type:drupal-core"
            ],
            "web/libraries/{$name}": [
                "type:drupal-library"
            ],
            "web/modules/composer/{$name}": [
                "type:drupal-module"
            ],
            "web/profiles/composer/{$name}": [
                "type:drupal-profile"
            ],
            "web/themes/composer/{$name}": [
                "type:drupal-theme"
            ],
            "drush/Commands/contrib/{$name}": [
                "type:drupal-drush"
            ],
            "web/private/scripts/quicksilver/{$name}/": [
                "type:quicksilver-script"
            ]
        },
        "composer-exit-on-patch-failure": true,
        "patchLevel": {
            "drupal/core": "-p2"
        },
        "patches": {
            "drupal/better_exposed_filters": {
                "fix undefined array key '#options' error": "./patches/composer/better_exposed_filters/fix_bef_#1.patch"
            },
            "drupal/rules": {
              "additional fixes to module for D10 compatibility": "./patches/composer/rules/fix_rules_for_D10_compatability_#1.patch"
            },
            "drupal/taxonomy_multidelete_terms": {
              "additional fixes to module for D10 compatibility": "./patches/composer/taxonomy_multidelete_terms/fix_taxonomy_multidelete_terms_for_D10_compatability_#1.patch"
            },
            "drupal/flexslider": {
              "additional fixes to module for D10 compatibility": "./patches/composer/flexslider/fix_flexslider_for_D10_compatability_#1.patch",
              "additional fix 2 to module for D10 compatibility": "./patches/composer/flexslider/fix_flexslider_for_D10_compatability_#2.patch"
            }
        },
        "patches-ignore": {
          "drupal/redirect_after_login": {
            "Headers have already been sent after upgrade to Drupal 9.2 (can't login)": "https://www.drupal.org/files/issues/2021-06-20/3214949.patch"
          },
          "drupal/tac_lite": {
            "fix d9 error on permission rebuild": "https://www.drupal.org/files/issues/2021-05-28/Fix_D9.patch"
          }
        },
        "drupal-lenient": {
          "allowed-list": [
            "drupal/better_exposed_filters",
            "drupal/rules",
            "drupal/taxonomy_multidelete_terms",
            "drupal/flexslider"
          ]
        },
        "hooks": {
            "post-checkout": "composer install",
            "post-merge": "composer install"
        },
        "drupal-scaffold": {
            "allowed-packages": [
                "pantheon-systems/drupal-integrations"
            ],
            "locations": {
                "web-root": "./web"
            },
            "file-mapping": {
                "[project-root]/.editorconfig": false,
                "[project-root]/pantheon.upstream.yml": false,
                "[project-root]/.gitattributes": false
            }
        }
    },
    "scripts": {
        "git-hooks": "vendor/bin/cghooks add --ignore-lock"
    },
    "config": {
        "preferred-install": "dist",
        "sort-packages": true,
        "platform": {
            "php": "8.1"
        },
        "allow-plugins": {
            "grasmash/drupal-security-warning": true,
            "zaporylie/composer-drupal-optimizations": true,
            "drupal/core-composer-scaffold": true,
            "cweagans/composer-patches": true,
            "composer/installers": true,
            "topfloor/composer-cleanup-vcs-dirs": true,
            "drupal/core-project-message": true,
            "phpstan/extension-installer": true,
            "mglaman/composer-drupal-lenient": true
        }
    },
    "require-dev": {
        "brainmaestro/composer-git-hooks": "^2.8",
        "grasmash/drupal-security-warning": "1.x-dev",
        "topfloor/composer-cleanup-vcs-dirs": "*"
    }
}

And this is the configuration (yml) file I was trying to config-import after making the change from node_type to entity_bundle:node

uuid: a4a66f36-3ba7-4444-8619-5a2c9e2affec
langcode: en
status: true
dependencies:
  module:
    - node
id: media
label: Media
code: |-
  iframe {
      border: 0;
      width: 400px;
  }

  section.content-area {
      padding: 20px;
      max-width: 1200px;
      margin: 0 auto;
  }
media: all
preprocess: true
conditions:
  'entity_bundle:node':
    id: 'entity_bundle:node'
    negate: false
    context_mapping:
      node: '@node.node_route_context:node'
    bundles:
      media: media
conditions_require_all: true
contexts: {  }
10
  • 1
    Are contributed modules at their latest versions? I know for example that pathauto had this problem.
    – cilefen
    Aug 8, 2023 at 14:59
  • Hii @cilefen, thanks for taking the time to assist me. The versions I have for the various modules (see above edit to post w/ composer.json details) are definitely ones that are compatible w/ Drupal 10 (may not all be the latest versions though). pathauto is definitely on the latest 1.11 - I presume you are referring to this issue. Aug 8, 2023 at 15:15
  • The error is specifically about Drupal\rules (nothing to do with Symfony as far as I can see) and I can't help but notice you have a pre-release version of that module installed.
    – cilefen
    Aug 8, 2023 at 16:00
  • Oh this question is about the second problem. It's a little confusing.
    – cilefen
    Aug 8, 2023 at 17:29
  • Yes @cilefen and my apologies if I created any confusion. The question is about the second error having to do with the PHP error w/ DrushStyle not being compatible with SymfonyStyle - although the reason I got there is because of the first error having to do with Rules. The reason I am on pre-release version is b/c the latest of Rules is not compatible w/ Drupal 10. rules 8.x-3.x-dev is compatible. I couldn't move forward w/ the upgrade w/out getting on to this version of the release. Although the latest is also an Alpha release. Aug 8, 2023 at 17:41

3 Answers 3

0

I also encountered this error after following instructions for upgrading from Drupal 9 to Drupal 10 on d.o.

With Drush 11 installed, I ran 'drush updb' and got the following:

PHP Fatal error:  Declaration of Drush\Style\DrushStyle::warning(array|string $message) must be compatible with Symfony\Component\Console\Style\SymfonyStyle::warning($message)

I found that installing drupal/core-recommended, as instructed on d.o., caused some Symfony packages to be locked to out-of-date versions, such as the symfony/console package which causes the incompatibility with Drush 11 that results in this error.

So I would advise to (composer) remove drupal/core-recommended and then (composer) require the latest version of Drupal 10 Core explicitly, and use the --with-all-dependencies option. Like:

composer require drupal/core:^10.1.5 --with-all-dependencies

I also had to remove Drush 11 before I could update to the latest version of drupal/core. Because Drush 11 was also locking some Drupal Core 10.1.5 dependency to an older version. So I removed Drush 11, then updated Drupal Core, then composer require'd Drush 11 again. This resolved the issue for me.

0

I will also join in on these answers. In my case, I had this issue locally with Lando on a Windows machine. I have excluded vendor and contrib modules and therefore they're only rebuilt when I explicitly call lando rebuild.

However despite doing this, lando did still have the old vendor/drush/drush/src/Style/DrushStyle.php inside the VM. I had to manually lando destroy (watch out, you'll lose the database) and then cleanly restart lando again to have it working just fine.

-1

I was able to resolve this by deleting the vendor folder and my composer.lock file and then reinstall all of my dependencies.

rm -rf vendor/
rm composer.lock

and then

composer install

This process will download and install fresh copies of all the necessary components based on the specifications in your composer.json file. Once this is done, try running Drush again to see if the problem has been resolved.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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