Upgrade to 5.30.x causes "Unrecognized asset name: crm-menubar.css" under Drupal 8 or 9
Overview
Why can't the asset builder find was posted by @AlanDixon, but I saw the same issue.
Reproduction steps
- Upgrade a Drupal 8 or 9 site to CiviCRM 5.30.+
- Clear caches or just click on CiviCRM.
- Got a white screen with "The website encountered an unexpected error. Please try again later.".
Current behaviour
What happens currently. Please provide error messages, screenshots or gifs (LICEcap, SilentCast) where appropriate.
27-Nov-2020 14:45:13 Europe/London] Uncaught PHP Exception Civi\Core\Exception\UnknownAssetException: "Unrecognized asset name: crm-menubar.css" at D:\CiviCRM_Custom.git\drupal8\vendor\civicrm\civicrm-core\Civi\Core\AssetBuilder.php line 217
Expected behaviour
What should happen.
You should get the CiviCRM web page.
Environment information
- Browser: Edge but probably irrelevant
- CiviCRM: 5.30.0/5.31.1/...
- PHP: 7.4..._ but probably irrrelevant
- CMS: Drupal 8/Drupal 9/... Not apparent in Drupal 7 or Joomla.
- Database: MySQL 5.7.7... but probably irrelevant
- Web Server: IIS This may be relevant
Comments
Anything else you would like the reviewer to note.
Extensive researched found that adding
\CRM_Core_Resources::renderMenubarStylesheet($event);
before line 168 in ../vendor/civicrm/civicrm-core/CRM/Utils/Hook.php
, in other words before the invoke function returns to its caller seems to solve the problem. I am not currently set up to produce a PR. It is possible that someone more expert than I can explain what the real issue is. It could be related to Composer and Windows.