#C31 Drupal-CMS 警告の解消

前回Drupal-CMSのアップデートで出たautomatic_updates モジュールの不具合を修正した際に出た警告の対策を行いました。

package_manager と automatic_updates を削除して再インストールを行なう事で対応したのですが削除をする際drupal_cms_starterとの依存関係が影響し削除が出来ないのでdrupal_cms_starterを削除しpackage_manager と automatic_updates の削除を行い、再インストールで対応しています。

drupal_cms_starterを削除したことで、Drupal-CMSに最初からインストールされるモジュールやテーマを同時に削除してしまい、依存関係が壊れたことで、修復するのに結構手間取っています。

Nortice.

私の環境がMacのローカル環境でDDEVを使い、プレリリースからのアップデートという環境で起きた事例なので、他の方での再現はないかもしれません。また、特殊な対応でDrupalがデフォルトで持つ依存関係を壊してしまう対応を行っていますので、同じ対応を行うと環境によっては修復出来ない可能性がありますので、記事を参考に作業を行なう場合、ご自身で状況を良く把握し調べた上で全て自己責任において行ってください。

今回の目的.

automatic_updatesモジュールのインストール時の管理画面のログを確認するとpackage_managerに関する警告が出ています。

エラーではないのでDrupal-CMSの利用に直接の影響は出ていないのですが気になるので調べてみます。

表示された警告

automatic_updatesモジュールのインストール時ターミナルに出た警告

[warning] foreach() argument must be of type array|object, null given Mapping.php:31
[warning] foreach() argument must be of type array|object, null given Mapping.php:230

管理画面のログに出たpackage_managerの警告

The following paths in /var/www/html aren't recognized as part of your Drupal site, so to be safe, Package Manager is excluding them from all stage operations. If these files are not needed for Composer to work properly in your site, no action is needed. Otherwise, you can disable this behavior by setting the package_manager.settings:include_unknown_files_in_project_root config setting to TRUE. .ddev README.md launch-drupal-cms.sh recipes

以下の警告が管理画面に常時表示されます。
//
利用中の1つ以上のモジュールやテーマの最新版が入手可能です。 サイトを適切に機能させ続けるために、できるだけ早く更新するべきです。このメッセージが管理画面に常時表示されてしまう不具合。コアプログラム、モジュールやテーマが全て最新で更新がなくても表示されてしまいます。
// 

以上の警告と更新案内が常時表示される不具合の解消をします。

今回の作業の要約

  1. automatic_updates モジュールの不具合を修正するため、package_manager と automatic_updates を削除するがautomatic_updatesがdrupal_cms_starterと依存関係で紐づいているので削除出来ず。
  2. automatic_updatesを削除するためにdrupal_cms_starterも削除しautomatic_updatesを削除
  3. 依存関係 (drupal_cms_starter) に紐付いているテーマ (gin, easy_email_theme, drupal_cms_olivero) やモジュールが同時に削除されます。
  4. 管理画面のテーマginも削除してしまったので管理画面もエラーでログイン出来ず。
  5. エラー表示されたeasy_breadcrumbが存在しないというエラーを再インストールにて修復
  6. テーマやモジュールを削除した影響で core.extension との不整合が発生し、収集がつかなくなる。
  7. PHP (PathLocator クラス) の不具合を修正。
  8. 必要なテーマ・モジュール (gin, package_manager など) を再インストール。
  9. モジュールは再インストールが完了するが、テーマのインストールで不具合が発生
  10. 管理画面のエラーを修復するためにGinの修復を行なう
  11. Ginのツールバーとの不整合を修復しGinの再インストールを行い管理画面は復旧するがエラーが表示されパッケージマネージャーと残りのテーマのインストールに問題が残る
  12. パッケージマネージャーとテーマの再インストール。この時点では依存関係のエラーが残る。
  13. YML (services.yml)の不具合を修正
  14. composer install で依存関係を修復し、drush updb でデータベースを更新。
  15. drush cr でキャッシュをクリアし、最終的にエラーが解消。
  16. KeyValueStore\DatabaseStorageに起因するエラーが表示される。DBに古いデータが残っていることに起因しているので削除することで対応。

以上の対応を行い警告メッセージ[ 利用中の1つ以上のモジュールやテーマの最新版が入手可能です。 サイトを適切に機能させ続けるために、できるだけ早く更新するべきです。 ]が常時表示される不具合の修正を行っています。

私の環境で出た固有の問題である可能性と、対応も正しい対応とは言えず参考にはならない記事ですが、私自身の備忘録として記事にしています。もし私の環境で出た固有の問題でなく、他の環境でも再現するDrupalコアやモジュールに起因するバグであった場合は、バグフィックスで対応すると考えられます。警告自体はDrupal-CMSの運用に直接の影響がありませんので、バグフィックスを待つ方が賢明でもありますので記事を見て私と同様の対応をする事はおすすめ出来ません。

今回の記事は、私自身が稚拙な知識で対応を行い、状態を悪化させてしまい、結果的には修復を完了していますが適切なエラー対処とは言い難い対応となっています。本来、別の適切な対処があると考えられますので、もし同様の不具合が出て対応をされる場合専門知識を持つ方に相談する事をおすすめします。

1.package_manager と automatic_updates を削除

automatic_updates モジュールの不具合を修正するため、package_manager と automatic_updates を削除。 

package_manager と automatic_updates を削除。

エラーログの警告を解消し、正しく package_manager が動作するように設定を変更します。

エラーログの警告を解消


// エラーログの警告を解消し、正しく package_manager が動作するように設定を変更します。
$ drush config:set package_manager.settings include_unknown_files_in_project_root TRUE -y
$ drush cr

// automatic_updatesのアップデート
$ composer require drupal/automatic_updates

./composer.json has been updated
Running composer update drupal/automatic_updates
Loading composer repositories with package information
Updating dependencies
Nothing to modify in lock file
Writing lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
Generating optimized autoload files
59 packages you are using are looking for funding.
Use the composer fund command to find out more!
Found 2 security vulnerability advisories affecting 1 package.
Run "composer audit" for a full list of advisories.
Using version ^3.1 for drupal/automatic_updates

結果

  • composer require drupal/automatic_updates を実行したが、Nothing to install, update or remove と表示されたため、すでにインストール済み。
  • composer audit を実行するよう推奨されている(セキュリティ脆弱性の可能性)
  • automatic_updates のバージョン ^3.1 が使用されている。

composer auditの実行


//composer auditを実行
$ composer audit

Found 2 security vulnerability advisories affecting 1 package:
+-------------------+----------------------------------------------------------------------------------+
| Package           | drupal/ai                                                                        |
| Severity          |                                                                                  |
| CVE               | NO CVE                                                                           |
| Title             | AI (Artificial Intelligence) - Critical - Remote Code Execution -                |
|                   | SA-CONTRIB-2025-021                                                              |
| URL               | https://www.drupal.org/sa-contrib-2025-021                                       |
| Affected versions | <1.0.5                                                                           |
| Reported at       | 2025-03-05T17:18:25+00:00                                                        |
| Advisory ID       | SA-CONTRIB-2025-021                                                              |
+-------------------+----------------------------------------------------------------------------------+
+-------------------+----------------------------------------------------------------------------------+
| Package           | drupal/ai                                                                        |
| Severity          |                                                                                  |
| CVE               | NO CVE                                                                           |
| Title             | AI (Artificial Intelligence) - Moderately critical - Gadget Chain -              |
|                   | SA-CONTRIB-2025-022                                                              |
| URL               | https://www.drupal.org/sa-contrib-2025-022                                       |
| Affected versions | <1.0.5                                                                           |
| Reported at       | 2025-03-05T17:27:19+00:00                                                        |
| Advisory ID       | SA-CONTRIB-2025-022                                                              |
+-------------------+----------------------------------------------------------------------------------+

結果

composer audit によって、drupal/ai モジュールに 2つのセキュリティ脆弱性(SA-CONTRIB-2025-021 および SA-CONTRIB-2025-022)が検出された。

  • 影響を受けるバージョンは 1.0.5 より前のバージョン。
  • 問題のモジュール (drupal/ai) は automatic_updates のエラーに直接関係ない可能性が高い が、安全のため修正が必要。

セキュリティ脆弱性の対応


// drupal/ai モジュールを最新バージョンにアップデート
$ composer update drupal/ai --with-dependencies
$ drush cr

drupal/aiモジュールの更新が完了しました。


automatic_updatesをアンインストールし削除してみます。

automatic_updatesをアンインストールし削除


$ drush pmu automatic_updates -y
$ composer remove drupal/automatic_updates
Removal failed, drupal/automatic_updates is still present, it may be required by another package. See composer why drupal/automatic_updates.

結果

  1. composer remove drupal/automatic_updates を実行したが、依存関係のため削除できなかった。
  2. automatic_updates モジュールは、他のモジュールやパッケージに依存されている可能性がある。

composer whyで依存関係の影響を確認してみます。


$ composer why drupal/automatic_updates
drupal/drupal_cms_starter 1.0.2        requires  drupal/automatic_updates (^3.1.7)
drupal/project_browser    2.0.0-alpha9 conflicts drupal/automatic_updates (<3.0)

結果

  1. drupal/drupal_cms_starter 1.0.2 が drupal/automatic_updates (^3.1.7) を必要としている。
  2. drupal/project_browser 2.0.0-alpha9 は drupal/automatic_updates のバージョン 3.0 未満と競合している(ただし、現在の automatic_updates は ^3.1 なので問題はなさそう)。

つまり、drupal/drupal_cms_starter が automatic_updates を依存しているため、単純に削除できない状況です。

2.drupal/drupal_cms_starter の影響

このモジュール (drupal/drupal_cms_starter) は、Drupalサイトのセットアップ用のスターターパッケージです。プロジェクトの実際の動作には 必須ではない可能性が高いので削除してみます。

drupal_cms_starter が必要なさそうので削除します。一緒にautomatic_updatesの削除も行います。

drupal_cms_starter とautomatic_updatesの削除

$ composer remove drupal/drupal_cms_starter drupal/automatic_updates

削除後以下のエラーが出てしまい。管理画面にログイン出来なくなってしまいます。
The website encountered an unexpected error. Try again later.
AssertionError: The file specified by the given app root, relative path and file name (/var/www/html/web/modules/contrib/easy_breadcrumb/easy_breadcrumb.info.yml) do not exist. in assert() (line 73 of core/lib/Drupal/Core/Extension/Extension.php).

結果

「The website encountered an unexpected error. Try again later.」 というエラーが発生。
AssertionError: The file specified by the given app root, relative path and file name (/var/www/html/web/modules/contrib/easy_breadcrumb/easy_breadcrumb.info.yml) do not exist. というエラーメッセージが core/lib/Drupal/Core/Extension/Extension.php:73 で発生。

この時点で、管理画面もページもエラー表示となってしまいます。

出ているエラーの対策

easy_breadcrumb モジュールが存在しない、または削除されたが設定に残っているとのメッセージが出ているのでeasy_breadcrumbのインストールを行います。

easy_breadcrumbのインストール

$ composer require drupal/easy_breadcrumb
$ drush en easy_breadcrumb -y
$ drush updb -y
$ drush cr
[warning] Drush command terminated abnormally.

結果

[warning] Drush command terminated abnormally. というエラーが発生しているため、drush コマンドが異常終了したことがわかります。

DBアップデートのエラー

drush updb -y
[error]  Package Manager is available for early testing. To install the module set the
value of 'testing_package_manager' to TRUE in your settings.php file.
[error]   (Currently using Missing or invalid modules The following modules are marked as installed in the core.extension
configuration, but they are missing:
* login_emailusername
* mailsystem
* project_browser
* redirect
* redirect_404
* sam
* symfony_mailer_lite
Review the  suggestions for resolving this incompatibility [1] to repair your
installation, and then re-run update.php.
[1] https://www.drupal.org/docs/updating-drupal/troubleshooting-database-updates
)
[error]   (Currently using Missing or invalid themes The following themes are marked as installed in the core.extension
configuration, but they are missing:
* gin
* easy_email_theme
* drupal_cms_olivero
Review the  suggestions for resolving this incompatibility [1] to repair your
installation, and then re-run update.php.
[1] https://www.drupal.org/docs/updating-drupal/troubleshooting-database-updates
)

結果

エラーログから Drupal のモジュールとテーマの整合性に問題がある ことが分かります。

主なエラー
    1.    Package Manager のテストモードが有効になっていない
    •    'testing_package_manager' の設定が settings.php で TRUE になっていない。
    2.    一部のモジュールが core.extension に登録されているが、実際には見つからない
    •    login_emailusername
    •    mailsystem
    •    project_browser
    •    redirect
    •    redirect_404
    •    sam
    •    symfony_mailer_lite
    3.    一部のテーマが core.extension に登録されているが、実際には見つからない
    •    gin
    •    easy_email_theme
    •    drupal_cms_olivero

エラーの対応.
  1. settings.php で testing_package_manager を有効化
  2. 不足しているモジュールの追加
  3. 不足しているテーマの追加

の対応をします。

1.testing_package_manager を有効化

settings.php に testing_package_manager の設定を追加します。

settings.php に testing_package_manager の設定を追加

web/sites/default/settings.phpに以下のコードを追加します。


$ settings['testing_package_manager'] = TRUE;

viを使ってsettings.phpを開き上記のコードを入力モード[i]で書き込み、[esc]で入力モードを抜け保存して終了[wq]をします。

2.不足しているモジュールを再インストール

composer requirで不足しているモジュールを追加します。

モジュールのインストール

不足しているモジュールを再インストール


$ composer require drupal/login_emailusername drupal/mailsystem drupal/project_browser drupal/redirect drupal/redirect_404 drupal/sam drupal/symfony_mailer_lite

./composer.json has been updated
Running composer update drupal/login_emailusername drupal/mailsystem drupal/project_browser drupal/redirect drupal/redirect_404 drupal/sam drupal/symfony_mailer_lite
Loading composer repositories with package information
Updating dependencies
Lock file operations: 10 installs, 0 updates, 0 removals
- Locking drupal/login_emailusername (3.0.1)
- Locking drupal/mailsystem (4.5.0)
- Locking drupal/project_browser (2.0.0-alpha10)
- Locking drupal/redirect (1.11.0)
- Locking drupal/redirect_404 (1.11.0)
- Locking drupal/sam (1.3.2)
- Locking drupal/symfony_mailer_lite (2.0.2)
- Locking html2text/html2text (4.3.2)
- Locking symfony/css-selector (v7.2.0)
- Locking tijsverkoyen/css-to-inline-styles (v2.3.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 10 installs, 0 updates, 0 removals
- Downloading drupal/project_browser (2.0.0-alpha10)
- Installing drupal/login_emailusername (3.0.1): Extracting archive
- Installing drupal/project_browser (2.0.0-alpha10): Extracting archive
- Installing drupal/redirect (1.11.0): Extracting archive
- Installing drupal/redirect_404 (1.11.0)
- Installing drupal/sam (1.3.2): Extracting archive
- Installing symfony/css-selector (v7.2.0): Extracting archive
- Installing tijsverkoyen/css-to-inline-styles (v2.3.0): Extracting archive
- Installing html2text/html2text (4.3.2): Extracting archive
- Installing drupal/mailsystem (4.5.0): Extracting archive
- Installing drupal/symfony_mailer_lite (2.0.2): Extracting archive
Generating optimized autoload files
58 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
No security vulnerability advisories found.
Using version ^3.0 for drupal/login_emailusername
Using version ^4.5 for drupal/mailsystem
Using version ^2.0@alpha for drupal/project_browser
Using version ^1.11 for drupal/redirect
Using version ^1.11 for drupal/redirect_404
Using version ^1.3 for drupal/sam
Using version ^2.0 for drupal/symfony_mailer_lite
$ drush cr
[success] Cache rebuild complete.

結果

モジュールのインストールは正常に行われます。

3.不足しているテーマを再インストール

モジュール同様composer requireでテーマをインストールします。

テーマのインストール

$ composer require drupal/gin drupal/easy_email_theme drupal/drupal_cms_olivero

./composer.json has been updated
Running composer update drupal/gin drupal/easy_email_theme drupal/drupal_cms_olivero
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
 Problem 1
   - Root composer.json requires drupal/gin * -> satisfiable by drupal/gin[1.0.0-alpha1, ..., 1.0.0-alpha14, 2.0.0-alpha1, ..., 2.0.0-alpha13, 3.0.0-alpha1, ..., 3.0.0, 4.0.0, ..., 4.0.6].
   - drupal/project_browser is locked to version 2.0.0-alpha10 and an update of this package was not requested.
   - drupal/gin[1.0.0-alpha4, ..., 1.0.0-alpha14] require drupal/core <8.8 -> found drupal/core[8.0.0-beta6, ..., 8.7.14] but the package is fixed to 11.1.4 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
   - drupal/gin[1.0.0-alpha1, ..., 1.0.0-alpha2] require drupal/core ~8.0 -> found drupal/core[8.0.0-beta6, ..., 8.9.20] but the package is fixed to 11.1.4 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
   - drupal/gin 1.0.0-alpha3 requires drupal/core ^8 || ^9 -> found drupal/core[8.0.0-beta6, ..., 8.9.20, 9.0.0-alpha1, ..., 9.5.11] but the package is fixed to 11.1.4 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
   - drupal/gin[2.0.0-alpha1, ..., 2.0.0-alpha3] require drupal/core ^8.8 -> found drupal/core[8.8.0-alpha1, ..., 8.9.20] but the package is fixed to 11.1.4 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
   - drupal/gin[2.0.0-alpha4, ..., 2.0.0-alpha13, 3.0.0-alpha1, ..., 3.0.0-alpha36] require drupal/core ^8.8 || ^9 -> found drupal/core[8.8.0-alpha1, ..., 8.9.20, 9.0.0-alpha1, ..., 9.5.11] but the package is fixed to 11.1.4 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
   - drupal/gin[3.0.0-beta1, ..., 3.0.0-rc1] require drupal/core ^8.9 || ^9 || ^10 -> found drupal/core[8.9.0-beta1, ..., 8.9.20, 9.0.0-alpha1, ..., 9.5.11, 10.0.0-alpha1, ..., 10.4.4] but the package is fixed to 11.1.4 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
   - drupal/gin[3.0.0-rc2, ..., 3.0.0-rc10] require drupal/core ^9 || ^10 -> found drupal/core[9.0.0-alpha1, ..., 9.5.11, 10.0.0-alpha1, ..., 10.4.4] but the package is fixed to 11.1.4 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
   - drupal/gin 3.0.0-alpha37 requires drupal/core ^8.8 || ^9 || ^10 -> found drupal/core[8.8.0-alpha1, ..., 8.9.20, 9.0.0-alpha1, ..., 9.5.11, 10.0.0-alpha1, ..., 10.4.4] but the package is fixed to 11.1.4 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
   - drupal/gin[4.0.1, ..., 4.0.6] require drupal/gin_toolbar ^2.0 -> found drupal/gin_toolbar[2.0.0] but it conflicts with your root composer.json require (1.0.0).
   - drupal/project_browser 2.0.0-alpha10 conflicts with drupal/gin 4.0.0.
   - drupal/project_browser 2.0.0-alpha10 conflicts with drupal/gin 3.0.0.
Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
You can also try re-running composer require with an explicit version constraint, e.g. "composer require drupal/gin:*" to figure out if any version is installable, or "composer require drupal/gin:^2.1" if you know which you need.
Installation failed, reverting ./composer.json and ./composer.lock to their original content.

$ drush cr
[success] Cache rebuild complete.

結果

エラーが出てしまいインストールが出来ません。DBのアップデートをしてみます。


$ drush updb -y
[error]   (Currently using Missing or invalid themes The following themes are marked as installed in the core.extension
configuration, but they are missing:
* gin
* easy_email_theme
* drupal_cms_olivero
Review the  suggestions for resolving this incompatibility [1] to repair your
installation, and then re-run update.php.
[1] https://www.drupal.org/docs/updating-drupal/troubleshooting-database-updates
)
// Requirements check reports errors. Do you wish to continue?: yes.
[success] No pending updates.

結果

core.extension に登録されているテーマ gin, easy_email_theme, drupal_cms_olivero が実際には見つからない。

インストール済みのテーマを確認してみます。

インストール済みテーマの確認

$ ls -l /var/www/html/web/themes/contrib/
total 0
drwxr-xr-x 1 shinichirotakeda dialout 698 Aug  8  2024 bootstrap5

結果

gin, easy_email_theme, drupal_cms_oliveroがインストールされていません。

末尾のメッセージ Installation failed, reverting ./composer.json and ./composer.lock to their original content.からcomposer require drupal/gin drupal/easy_email_theme drupal/drupal_cms_olivero を実行したが、インストールが失敗 し、composer.json と composer.lock が元に戻された事がわかります。

composer.json にエラーがないかチェックします。composer validateを使い確認します。

composer validateでチェック

$ composer validate

./composer.json is valid, but with a few warnings
See https://getcomposer.org/doc/04-schema.md for details on the schema
# General warnings
- require.drupal/autosave_form : exact version constraints (1.10.0) should be avoided if the package follows semantic versioning
- require.drupal/better_exposed_filters : exact version constraints (7.0.5) should be avoided if the package follows semantic versioning
- require.drupal/bpmn_io : exact version constraints (2.0.7) should be avoided if the package follows semantic versioning
- require.drupal/coffee : exact version constraints (2.0.1) should be avoided if the package follows semantic versioning
- require.drupal/core-composer-scaffold : exact version constraints (11.1.4) should be avoided if the package follows semantic versioning
- require.drupal/core-project-message : exact version constraints (11.1.4) should be avoided if the package follows semantic versioning
- require.drupal/core-recommended : exact version constraints (11.1.4) should be avoided if the package follows semantic versioning
- require.drupal/dashboard : exact version constraints (2.0.0) should be avoided if the package follows semantic versioning
- require.drupal/easy_email : exact version constraints (3.0.4) should be avoided if the package follows semantic versioning
- require.drupal/gin_toolbar : exact version constraints (1.0.0) should be avoided if the package follows semantic versioning
- require.drupal/honeypot : exact version constraints (2.2.2) should be avoided if the package follows semantic versioning
- require.drupal/klaro : exact version constraints (3.0.0) should be avoided if the package follows semantic versioning

結果

composer validate の結果、composer.json は有効 だが いくつかの警告があります。ただこの警告は直接のエラーではない ため、現在の gin などのテーマがインストールできない原因とは別の問題です。

エラー内容の再確認をします。

  1. drupal/gin をインストールしようとしたが、Drupal コアのバージョン (11.1.4) と依存関係が合わない。
  2. drupal/project_browser 2.0.0-alpha10 と drupal/gin に 競合 が発生している。
  3. drupal/gin 4.0.x が drupal/gin_toolbar ^2.0 を必要としているが、composer.json には gin_toolbar 1.0.0 が指定されており バージョン競合 が起きている。 

Ginの確認

$ composer show drupal/gin --all | grep versions

versions : 4.0.x-dev, 4.0.6, 4.0.5, 4.0.4, 4.0.3, 4.0.2, 4.0.1, 4.0.0, 3.x-dev, 3.0.0, 3.0.0-rc16, 3.0.0-rc15, 3.0.0-rc14, 3.0.0-rc13, 3.0.0-rc12, 3.0.0-rc11, 3.0.0-rc10, 3.0.0-rc9, 3.0.0-rc8, 3.0.0-rc7, 3.0.0-rc6, 3.0.0-rc5, 3.0.0-rc4, 3.0.0-rc3, 3.0.0-rc2, 3.0.0-rc1, 3.0.0-beta5, 3.0.0-beta4, 3.0.0-beta3, 3.0.0-beta2, 3.0.0-beta1, 3.0.0-alpha37, 3.0.0-alpha36, 3.0.0-alpha35, 3.0.0-alpha34, 3.0.0-alpha33, 3.0.0-alpha32, 3.0.0-alpha31, 3.0.0-alpha30, 3.0.0-alpha29, 3.0.0-alpha28, 3.0.0-alpha27, 3.0.0-alpha26, 3.0.0-alpha25, 3.0.0-alpha24, 3.0.0-alpha23, 3.0.0-alpha22, 3.0.0-alpha21, 3.0.0-alpha20, 3.0.0-alpha19, 3.0.0-alpha18, 3.0.0-alpha17, 3.0.0-alpha16, 3.0.0-alpha15, 3.0.0-alpha14, 3.0.0-alpha13, 3.0.0-alpha12, 3.0.0-alpha11, 3.0.0-alpha10, 3.0.0-alpha9, 3.0.0-alpha8, 3.0.0-alpha7, 3.0.0-alpha6, 3.0.0-alpha5, 3.0.0-alpha4, 3.0.0-alpha3, 3.0.0-alpha2, 3.0.0-alpha1, 2.x-dev, 2.0.0-alpha13, 2.0.0-alpha12, 2.0.0-alpha11, 2.0.0-alpha10, 2.0.0-alpha9, 2.0.0-alpha8, 2.0.0-alpha7, 2.0.0-alpha6, 2.0.0-alpha5, 2.0.0-alpha4, 2.0.0-alpha3, 2.0.0-alpha2, 2.0.0-alpha1, 1.x-dev, 1.0.0-alpha14, 1.0.0-alpha13, 1.0.0-alpha12, 1.0.0-alpha11, 1.0.0-alpha10, 1.0.0-alpha9, 1.0.0-alpha8, 1.0.0-alpha7, 1.0.0-alpha6, 1.0.0-alpha5, 1.0.0-alpha4, 1.0.0-alpha3, 1.0.0-alpha2, 1.0.0-alpha1, dev-3.x, dev-4.0.x, dev-2.x, dev-1.x

gin 4.0.x をインストールするためには、gin_toolbar ^2.0 が必要なので gin_toolbar をアップグレードします。

Ginツールバーのアップデート

$ composer require drupal/gin_toolbar:^2.0 --with-dependencies

./composer.json has been updated
Running composer update drupal/gin_toolbar --with-dependencies
Loading composer repositories with package information
Updating dependencies
Lock file operations: 0 installs, 1 update, 0 removals
- Upgrading drupal/gin_toolbar (1.0.0 => 2.0.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 0 installs, 1 update, 0 removals
- Downloading drupal/gin_toolbar (2.0.0)
- Upgrading drupal/gin_toolbar (1.0.0 => 2.0.0): Extracting archive
Generating optimized autoload files
58 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
No security vulnerability advisories found.

$ drush cr
[success] Cache rebuild complete.

Ginのインストールをします。

Ginのインストール

$ composer require drupal/gin

./composer.json has been updated
Running composer update drupal/gin
Loading composer repositories with package information
Updating dependencies
Lock file operations: 1 install, 0 updates, 0 removals
- Locking drupal/gin (4.0.6)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
- Downloading drupal/gin (4.0.6)
- Installing drupal/gin (4.0.6): Extracting archive
Generating optimized autoload files
59 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
No security vulnerability advisories found.
Using version ^4.0 for drupal/gin

$ drush cr
[success] Cache rebuild complete.

Ginがインストール出来ました。このインストールで管理画面が復旧しログインが可能となります。

パッケージマネージャーのエラー

Ginが復旧したので管理画面にログインします。管理/レポート/サイトの状態にエラーが出ています。エラーログを確認すると以下のエラーが表示されています。

表示されたエラー

The website encountered an unexpected error. Try again later.
Error: Class "Drupal\package_manager\PathLocator" not found in Drupal\Component\DependencyInjection\Container->createService() (line 259 of core/lib/Drupal/Component/DependencyInjection/Container.php).
Drupal\Component\DependencyInjection\Container->get() (Line: 430)
Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters() (Line: 237)
Drupal\Component\DependencyInjection\Container->createService() (Line: 177)
Drupal\Component\DependencyInjection\Container->get() (Line: 197)
Drupal::service() (Line: 38)
package_manager_requirements()
call_user_func_array() (Line: 355)
Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}() (Line: 307)
Drupal\Core\Extension\ModuleHandler->invokeAllWith() (Line: 354)
Drupal\Core\Extension\ModuleHandler->invokeAll() (Line: 109)
Drupal\system\SystemManager->listRequirements() (Line: 53)
Drupal\system\Controller\SystemInfoController->status()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 593)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 183)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 116)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 90)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 709)
Drupal\Core\DrupalKernel->handle() (Line: 19)

  1. サイトが 「The website encountered an unexpected error. Try again later.」 で落ちている。
  2. Drupal\package_manager\PathLocator クラスが見つからない というエラーが発生。
  3. エラー発生箇所: core/lib/Drupal/Component/DependencyInjection/Container.php の createService() メソッド。
  1. package_manager モジュールが壊れている > モジュールが composer のアップデートや削除の影響で不完全な状態になっている。
  2. Drupal のキャッシュが古いまま > 削除されたモジュールや古いバージョンの情報が残っている。
  3. 依存関係が破損している > composer update の途中でエラーが発生し、package_manager の関連パッケージが消えた可能性がある。
  • package_manager を再インストール
  • composer update が中途半端に終わっている場合、すべての依存関係を修復します。

パッケージマネージャーのインストールをします。

パッケージマネージャーのインストール

$ composer require drupal/package_manager --with-all-dependencies

./composer.json has been updated
Running composer update drupal/package_manager --with-all-dependencies
Loading composer repositories with package information
Updating dependencies
Lock file operations: 2 installs, 0 updates, 0 removals
- Locking drupal/automatic_updates (3.1.7)
- Locking drupal/package_manager (3.1.7)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 2 installs, 0 updates, 0 removals
- Downloading drupal/automatic_updates (3.1.7)
- Installing drupal/automatic_updates (3.1.7): Extracting archive
- Installing drupal/package_manager (3.1.7)
Generating optimized autoload files
59 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
No security vulnerability advisories found.
Using version ^3.1 for drupal/package_manager
However, you may be able to use a command like:

$ drush cr
In DefinitionErrorExceptionPass.php line 48:
 Cannot autowire service "Drupal\package_manager\Validator\LockFileValidator
 ": argument "$keyValueFactory" of method "__construct()" references interfa
 ce "Drupal\Core\KeyValueStore\KeyValueFactoryInterface" but no such service
  exists. You should maybe alias this interface to one of these existing ser
 vices: "keyvalue", "keyvalue.database", "keyvalue.expirable".

依存関係の修復


  $ composer install
  
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Nothing to install, update or remove
Generating optimized autoload files
59 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
* Homepage: https://www.drupal.org/project/drupal
* Support:
 * docs: https://drupal.org/docs/user_guide/en/index.html
 * chat: https://drupal.org/node/314178
 
$ composer update --lock
Loading composer repositories with package information
Updating dependencies
Nothing to modify in lock file
Writing lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
Generating optimized autoload files
59 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
No security vulnerability advisories found.
 $ drush cr
 
In DefinitionErrorExceptionPass.php line 48:
 Cannot autowire service "Drupal\package_manager\Validator\LockFileValidator
 ": argument "$keyValueFactory" of method "__construct()" references interfa
 ce "Drupal\Core\KeyValueStore\KeyValueFactoryInterface" but no such service
  exists. You should maybe alias this interface to one of these existing ser
 vices: "keyvalue", "keyvalue.database", "keyvalue.expirable".

結果

  1. Drupal の package_manager に関連するサービスの依存関係が壊れている。
  2. LockFileValidator のコンストラクタが KeyValueFactoryInterface を要求しているが、このサービスが見つからない というエラー。
  3. keyvalue サービス (keyvalue.database, keyvalue.expirable) には存在するが、適切なエイリアス (alias) がない可能性がある。
  1. パッケージマネージャーを削除し再インストールしてみましたが、状況は変わりません。※ターミナルの情報は省略します。
  2. keyvalue サービスのエイリアスの確認 > services.yml で KeyValueFactoryInterface が適切にマッピングされているか確認します。
  3. Watchdogでエラーを確認してみます

WatchDogのエラー確認

WatchDog

$ drush watchdog:show --severity=error --count=10

In WatchdogCommands.php line 330:
 Unknown severity level: error
 Valid severity levels are: 緊急(0), 警告(1), 重大な(2), エラー(3), 警告(4),
  注意(5), Info(6), デバッグ(7).
 Either use the default language levels, or use a number.

Severityに該当する番号を入れます。今回はエラーを見ますので”3”を指定


 $ drush watchdog:show --severity=3 --count=10
 
----- -------------- ------ ---------- --------------------------------------
 ID    Date           Type   Severity   Message
----- -------------- ------ ---------- --------------------------------------
 625   09/Mar 18:31   php    エラー     Error: Class
                                        "Drupal\package_manager\PathLocator"
                                        not found in
                                        Drupal\Component\DependencyInjection
                                        \Container->createService() (line
                                        259 of
                                        /var/www/html/web/core/lib/Drupal/Co
                                        mponent/Depe
 622   09/Mar 18:29   php    エラー     Drupal\Core\Extension\Exception\Unkn
                                        ownExtensionException: The theme gin
                                        does not exist. in
                                        Drupal\Core\Extension\ExtensionList-
                                        >getPathname() (line 519 of
                                        /var/www/html/web/core/lib/Drupa
 621   09/Mar 18:24   php    エラー     InvalidArgumentException: Class
                                        "Drupal\gin\GinSettings" does not
                                        exist. in
                                        Drupal\Core\DependencyInjection\Clas
                                        sResolver->getInstanceFromDefinition
                                        () (line 32 of
                                        /var/www/html/web/core/li
 616   09/Mar 18:16   php    エラー     Error: Class
                                        "Drupal\package_manager\PathLocator"
                                        not found in
                                        Drupal\Component\DependencyInjection
                                        \Container->createService() (line
                                        259 of
                                        /var/www/html/web/core/lib/Drupal/Co
                                        mponent/Depe
 613   09/Mar 18:16   php    エラー     Drupal\Core\Extension\Exception\Unkn
                                        ownExtensionException: The theme gin
                                        does not exist. in
                                        Drupal\Core\Extension\ExtensionList-
                                        >getPathname() (line 519 of
                                        /var/www/html/web/core/lib/Drupa
 612   09/Mar 18:14   php    エラー     InvalidArgumentException: Class
                                        "Drupal\gin\GinSettings" does not
                                        exist. in
                                        Drupal\Core\DependencyInjection\Clas
                                        sResolver->getInstanceFromDefinition
                                        () (line 32 of
                                        /var/www/html/web/core/li
 424   02/Mar 03:26   php    エラー     LogicException: Stored hash key
                                        deleted. in
                                        Drupal\package_manager\Validator\Loc
                                        kFileValidator->validate() (line 122
                                        of
                                        /var/www/html/web/modules/contrib/au
                                        tomatic_updates/package_manager/
 421   02/Mar 02:36   php    エラー     LogicException: Stored hash key
                                        deleted. in
                                        Drupal\package_manager\Validator\Loc
                                        kFileValidator->validate() (line 122
                                        of
                                        /var/www/html/web/modules/contrib/au
                                        tomatic_updates/package_manager/
 420   02/Mar 02:24   php    エラー     LogicException: Stored hash key
                                        deleted. in
                                        Drupal\package_manager\Validator\Loc
                                        kFileValidator->validate() (line 122
                                        of
                                        /var/www/html/web/modules/contrib/au
                                        tomatic_updates/package_manager/
 419   02/Mar 02:19   php    エラー     LogicException: Stored hash key
                                        deleted. in
                                        Drupal\package_manager\Validator\Loc
                                        kFileValidator->validate() (line 122
                                        of
                                        /var/www/html/web/modules/contrib/au
                                        tomatic_updates/package_manager/          
                         
[1] https://www.drupal.org/docs/updating-drupal/troubleshooting-database-updates
)

結果

  1. Error: Class "Drupal\package_manager\PathLocator" not found
  2. The theme gin does not exist.
  3. InvalidArgumentException: Class "Drupal\gin\GinSettings" does not exist.
  4. LogicException: Stored hash key deleted.
  • package_manager モジュールが壊れているか、正しくインストールされていない。
  • gin テーマが削除されたか、正しくインストールされていない。
  • gin テーマの設定ファイルが破損している可能性がある。
  • package_manager のデータが破損している可能性がある。

テーマのインストール状況を確認します。

テーマの確認

$ ls -l /var/www/html/web/themes/contrib/
total 0
drwxr-xr-x 1 shinichirotakeda dialout 698 Aug  8  2024 bootstrap5
drwxr-xr-x 1 shinichirotakeda dialout 776 Feb 28 19:36 gin

Ginはインストール完了しています。エラーが出ているので再度インストールを行います。

テーマのインストール

テーマのインストール

easy_email_themeとdrupal_cms_oliveroのインストール


$ composer require drupal/easy_email_theme drupal/drupal_cms_olivero --with-all-dependencies

./composer.json has been updated
Running composer update drupal/easy_email_theme drupal/drupal_cms_olivero --with-all-dependencies
Loading composer repositories with package information
Updating dependencies
Lock file operations: 2 installs, 0 updates, 0 removals
- Locking drupal/drupal_cms_olivero (1.0.1)
- Locking drupal/easy_email_theme (1.0.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 2 installs, 0 updates, 0 removals
- Downloading drupal/drupal_cms_olivero (1.0.1)
- Downloading drupal/easy_email_theme (1.0.0)
- Installing drupal/drupal_cms_olivero (1.0.1): Extracting archive
- Installing drupal/easy_email_theme (1.0.0): Extracting archive
Generating optimized autoload files
59 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
No security vulnerability advisories found.
Using version ^1.0 for drupal/easy_email_theme
Using version ^1.0 for drupal/drupal_cms_olivero

$ drush cr
In DefinitionErrorExceptionPass.php line 48:
 Cannot autowire service "Drupal\package_manager\Validator\LockFileValidator
 ": argument "$keyValueFactory" of method "__construct()" references interfa
 ce "Drupal\Core\KeyValueStore\KeyValueFactoryInterface" but no such service
  exists. You should maybe alias this interface to one of these existing ser
 vices: "keyvalue", "keyvalue.database", "keyvalue.expirable".

Ginのインストール


$ composer require drupal/gin --with-all-dependencies

./composer.json has been updated
Running composer update drupal/gin --with-all-dependencies
Loading composer repositories with package information
Updating dependencies
Nothing to modify in lock file
Writing lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
Generating optimized autoload files
59 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
No security vulnerability advisories found.
Using version ^4.0 for drupal/gin

$ drush cr
In DefinitionErrorExceptionPass.php line 48:
 Cannot autowire service "Drupal\package_manager\Validator\LockFileValidator
 ": argument "$keyValueFactory" of method "__construct()" references interfa
 ce "Drupal\Core\KeyValueStore\KeyValueFactoryInterface" but no such service
  exists. You should maybe alias this interface to one of these existing ser
 vices: "keyvalue", "keyvalue.database", "keyvalue.expirable".

エラーは出ますがテーマのインストールは完了しています。

 パッケージマネージャーを削除して再インストールします。

パッケージマネージャーの再インストール

パッケージマネージャーの削除

$ composer remove drupal/package_manager

./composer.json has been updated
Running composer update drupal/package_manager
Loading composer repositories with package information
Updating dependencies
Lock file operations: 0 installs, 0 updates, 2 removals
- Removing drupal/automatic_updates (3.1.7)
- Removing drupal/package_manager (3.1.7)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 0 installs, 0 updates, 2 removals
- Removing drupal/package_manager (3.1.7)
- Removing drupal/automatic_updates (3.1.7)
0/1 [>---------------------------]   0%Deleting /var/www/html/web/modules/contrib/automatic_updates - deleted
Generating optimized autoload files
59 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
Scaffolding files for drupal/core:
- Copy [web-root]/sites/default/default.services.yml from assets/scaffold/files/default.services.yml
No security vulnerability advisories found.

パッケージマネージャーのインストール


$ composer require drupal/package_manager --with-all-dependencies

./composer.json has been updated
Running composer update drupal/package_manager --with-all-dependencies
Loading composer repositories with package information
Updating dependencies
Lock file operations: 2 installs, 0 updates, 0 removals
- Locking drupal/automatic_updates (3.1.7)
- Locking drupal/package_manager (3.1.7)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 2 installs, 0 updates, 0 removals
- Installing drupal/automatic_updates (3.1.7): Extracting archive
- Installing drupal/package_manager (3.1.7)
Generating optimized autoload files
59 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
No security vulnerability advisories found.
Using version ^3.1 for drupal/package_manager

$ drush cr
In DefinitionErrorExceptionPass.php line 48:
 Cannot autowire service "Drupal\package_manager\Validator\LockFileValidator
 ": argument "$keyValueFactory" of method "__construct()" references interfa
 ce "Drupal\Core\KeyValueStore\KeyValueFactoryInterface" but no such service
  exists. You should maybe alias this interface to one of these existing ser
 vices: "keyvalue", "keyvalue.database", "keyvalue.expirable".

まだエラーは出ています。

services.yml で KeyValueFactoryInterface が適切にマッピングされているか確認します。

services.yml

keyvalue サービスのエイリアスの確認 > services.yml で KeyValueFactoryInterface が適切にマッピングされているか確認します。

KeyValueFactoryInterfaceの追加

web/sites/default/services.ymlに以下を追加


services:
Drupal\Core\KeyValueStore\KeyValueFactoryInterface:
  alias: keyvalue

services.ymlに上記を記述しキャッシュをクリアします。


$ drush cr

Cannot autowire service "Drupal\package_manager\Validator\LockFileValidator
 ": argument "$keyValueFactory" of method "__construct()" references interfa
 ce "Drupal\Core\KeyValueStore\KeyValueFactoryInterface" but no such service
  exists. You should maybe alias this interface to one of these existing ser
 vices: "keyvalue", "keyvalue.database", "keyvalue.expirable".

依存関係の修復をします。

依存関係の修復

$ composer install
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Nothing to install, update or remove
Generating optimized autoload files
59 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
* Homepage: https://www.drupal.org/project/drupal
* Support:
 * docs: https://drupal.org/docs/user_guide/en/index.html
 * chat: https://drupal.org/node/314178
 
$ composer update --lock
Loading composer repositories with package information
Updating dependencies
Nothing to modify in lock file
Writing lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
Generating optimized autoload files
59 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
No security vulnerability advisories found.

$ drush cr
In DefinitionErrorExceptionPass.php line 48:
 Cannot autowire service "Drupal\package_manager\Validator\LockFileValidator
 ": argument "$keyValueFactory" of method "__construct()" references interfa
 ce "Drupal\Core\KeyValueStore\KeyValueFactoryInterface" but no such service
  exists. You should maybe alias this interface to one of these existing ser
 vices: "keyvalue", "keyvalue.database", "keyvalue.expirable".

エラーが残っていますがDBのクリアを行いキャッシュのクリアを行います。

DBのアップデートを行いキャッシュをクリアします。

$ drush updb -y
[success] No pending updates.
$ drush cr
[success] Cache rebuild complete.

これまでdrush crで出ていたエラーが消えます。以上でエラーの修復が完了します。

修復の完了

これまで以上の作業を進めてきましたが、DBのアップデートを行なう事で出ていたエラーの修復が完了します。

  1. automatic_updates モジュールの不具合を修正するため、package_manager と automatic_updates を削除するがautomatic_updatesがdrupal_cms_starterと依存関係で紐づいているので削除出来ず。
  2. automatic_updatesを削除するためにdrupal_cms_starterも削除しautomatic_updatesを削除
  3. 依存関係 (drupal_cms_starter) に紐付いているテーマ (gin, easy_email_theme, drupal_cms_olivero) やモジュールを同時に削除。
  4. 管理画面のテーマginも削除してしまったので管理画面もエラーでログイン出来ず。
  5. エラー表示されたeasy_breadcrumbが存在しないというエラーを再インストールにて修復
  6. テーマやモジュールを削除した影響で core.extension との不整合が発生し、収集がつかなくなる。
  7. PHP (PathLocator クラス) の不具合を修正。
  8. 必要なテーマ・モジュール (gin, package_manager など) を再インストール。
  9. モジュールは再インストールが完了するが、テーマのインストールで不具合が発生
  10. 管理画面のエラーを修復するためにGinの修復を行なう
  11. Ginのツールバーとの不整合を修復しGinの再インストールを行い管理画面は復旧するがエラーが表示されパッケージマネージャーと残りのテーマのインストールに問題が残る
  12. パッケージマネージャーとテーマの再インストール。この時点では依存関係のエラーが残る。
  13. YML (services.yml)の不具合を修正
  14. composer install で依存関係を修復し、drush updb でデータベースを更新。
  15. drush cr でキャッシュをクリアし、最終的にエラーが解消。

非常に長い記事となってしまいましたが、今回の不具合修正で出てしまったエラーを完全に修復出来ました。

古いデータの削除

エラーの修復が終わったと考えていましたが管理画面を見るとまだエラーが残っています。

管理画面に出ているエラーログ

Deprecated function: Creation of dynamic property Drupal\project_browser\ProjectBrowser\Project::$commands is deprecated in Drupal\Component\Serialization\PhpSerialize::decode() (line 21 of core/lib/Drupal/Component/Serialization/PhpSerialize.php).
Drupal\Component\Serialization\PhpSerialize::decode() (Line: 86)
Drupal\Core\KeyValueStore\DatabaseStorage->getMultiple() (Line: 121)
Drupal\project_browser\EnabledSourceHandler->getProjects() (Line: 62)
Drupal\project_browser\Controller\ProjectBrowserEndpointController->getAllProjects()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 593)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 183)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 116)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 90)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 709)
Drupal\Core\DrupalKernel->handle() (Line: 19)

  1. Drupal\project_browser\ProjectBrowser\Project クラス内で、動的プロパティ $commands が作成されているが、Drupal の新しいバージョンでは 動的プロパティの作成が非推奨(deprecated) になっている。
  2. PhpSerialize::decode() を介して、KeyValueStore から取得したデータをデシリアライズする際に、問題が発生。

このエラーは KeyValueStore\DatabaseStorage に古いデータが残っている 可能性があるため、削除することで解決できる場合があります。以下で古いデータの削除を行います。

KeyValueStore\DatabaseStorageに残った古いデータの削除

$ drush updb -y
$ drush cr
$ drush sqlq "DELETE FROM key_value WHERE collection='project_browser'"
$ drush cr

以上で依存関係の修復が完了し全てのエラーを解消しています。

Conclude.

表示された警告

automatic_updatesモジュールのインストール時ターミナルに出た警告

[warning] foreach() argument must be of type array|object, null given Mapping.php:31
[warning] foreach() argument must be of type array|object, null given Mapping.php:230

管理画面のログに出たpackage_managerの警告

The following paths in /var/www/html aren't recognized as part of your Drupal site, so to be safe, Package Manager is excluding them from all stage operations. If these files are not needed for Composer to work properly in your site, no action is needed. Otherwise, you can disable this behavior by setting the package_manager.settings:include_unknown_files_in_project_root config setting to TRUE. .ddev README.md launch-drupal-cms.sh recipes

以下の警告が管理画面に常時表示されます。
//
利用中の1つ以上のモジュールやテーマの最新版が入手可能です。 サイトを適切に機能させ続けるために、できるだけ早く更新するべきです。このメッセージが管理画面に常時表示されてしまう不具合。コアプログラム、モジュールやテーマが全て最新で更新がなくても表示されてしまいます。
// 

上記の警告に対応するために、automatic_updatesとpackage_managerを削除して再インストールを行なう作業を行っていますがdrupal_cms_starterに依存関係が紐づいており、drupal_cms_starterの削除を行ったのですがDrupalがデフォルトで持っていた依存関係や設定ファイルが破損し、修復に結構な手間がかかりました。

そのことで修復に関わるプロセスが多く記事が非常に長くなってしまいました。記事最初に書きましたが、今回の警告やエラーが私の環境に起因する事も考えられ、修復のプロセスも正しいプロセスではない可能性があります。同様な不具合に遭遇した場合、今回私が行った対応では状況を悪化させる可能性もありますので、もし似たようなエラーや警告が出てしまった場合、ご自身の環境や状況を把握し専門知識を持つ方に相談し対応する事をおすすめします。
 

投稿日
2025-03-18
投稿者
S.Takeda
タグ
記事内容
関連記事.

DrupalやWebサイト構築の関連記事になります。宜しければご覧ください。

#C15 コンテンツとサイト構築の使い方.

Drupalはページ作成するコンテンツメニューと、サイト構築メニューでサイト構成を目的とする形に設定しないとデフォルトで用意されるページ構成から抜け出せず自由にページを構成する事が出来ません。この事についてまとめています。

Drupal Articles.

#C13 Drupal コンテンツ機能の概要 .

Drupalで実際に使用するページやブロックを作成するメニューになります。別記するサイト構築の設定と組み合わせて目的のページを作成して行きます。Drupalでページを作成する基本となる機能になります。

Drupal Articles.

#C30 Drupal-CMS Automatic Updateのエラー

プレリリースのインストールを行ったDrupal-CMSにしばらく触れなかったので正式版となったDrupal-CMS1.0にアップデートしたのですが、Automatic Updateモジュールのアップデートでエラーが出てしまいましたので修復します。

Drupal Articles.
Side Bar 01

Word Pressで制作したLife StyleのBlogをDrupalに移植し、Drupalの記事を含めて更新中です。

Drupal初学者のBlogです。

DrupalやWEBサイト構築についての記事をまとめています。

  全ての記事

  Drupalに関わること

  WEBサイト構築

  Macの環境

  AWSに関わる事

古着やファッションについての記事をまとめています。

  全ての記事

  古着について

  Fashionについて

  時計について

  写真について

  お勧めのお店

Core Drupal 10.4.5

Theme Bootstrap5 4.0.3

  Drupal

  bootstrap5

  Bootstrap

  Font Awesome

  Amazon Web Service

  Amazon Lightsail

  Bitnami

  Google reCAPTCHA