Adobe Commerce 2.4.4 へのアップグレード時の Composer プラグインの問題

この文書では、Adobe Commerce 2.4.3 以前からAdobe Commerce 2.4.4 以降(将来のバージョンがリリースされた場合)にアップグレードする際の、Composer プラグインの問題を回避する方法について説明します。

影響を受ける製品とバージョン

  • Adobe Commerce オンプレミス、2.4.4 以降(リリース時)にアップデートする際の任意のバージョン
  • クラウドインフラストラクチャー上のAdobe Commerce、2.4.4 以降(リリース時)にアップデートする際の任意のバージョン
  • Magento Open Source、2.4.4 以上にアップデートする際のすべてのバージョン(リリース時)

問題

2022 年 7 月以降にAdobe Commerce 2.4.4 以降にアップデートすると、プラグインに関して composer から警告が表示される場合があります。

再現手順 :

前提条件:Adobe Commerce 2.4.3 以前がインストールされている。

  1. アップグレードの実行の説明に従って、アップグレードを開始します。
  2. composer update コマンドを実行して、Adobe Commerce アプリケーションをアップグレードします。

期待される結果 :

アップグレードが正常に終了しました。

実際の結果 :

インストールが失敗し、次のようなエラーが表示されます。

Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 591 installs, 0 updates, 0 removals
  - Installing laminas/laminas-dependency-plugin (2.2.0): Extracting archive
laminas/laminas-dependency-plugin contains a Composer plugin which is currently not in your allow-plugins config. See https://getcomposer.org/allow-plugins
Do you trust "laminas/laminas-dependency-plugin" to execute code and wish to enable it now? (writes "allow-plugins" to composer.json) [y,n,d,?] y
Plugin initialization failed (require(app/etc/NonComposerComponentRegistration.php): failed to open stream: No such file or directory), uninstalling plugin
  - Removing laminas/laminas-dependency-plugin (2.2.0)
    Install of laminas/laminas-dependency-plugin failed


  [ErrorException]
  require(app/etc/NonComposerComponentRegistration.php): failed to open stream: No such file or directory

原因:

2022 年 7 月以降、Composer は allow-plugins オプションのデフォルト値を {} に変更し許可されない限りプラグインは読み込まれません。

解決策

Adobe Commerceのインストール方法に応じて、composer.json ファイルに次の内容を追加します。

  • プロジェクトが作成されている場合 composer create-project コマンドを使用:

    code language-json
    "config": {
        "allow-plugins": {
            "dealerdirect/phpcodesniffer-composer-installer": true,
            "laminas/laminas-dependency-plugin": true,
            "magento/*": true
        }
    }
    
  • プロジェクトが別の方法で作成され、"require-dev" のセクションに "dealerdirect/phpcodesniffer-installer" がない場合:

    code language-json
    "config": {
        "allow-plugins": {
            "laminas/laminas-dependency-plugin": true,
            "magento/*": true
        }
    }
    

composer.json ファイルを更新した後、composer update コマンドを実行し、アップグレードプロセスを再開します。

recommendation-more-help
8bd06ef0-b3d5-4137-b74e-d7b00485808a