ÃÛ¶¹ÊÓÆµ

Composer plugins issues when upgrading to ÃÛ¶¹ÊÓÆµ Commerce 2.4.4

This article provides a solution to avoid issues with composer plugins when upgrading from ÃÛ¶¹ÊÓÆµ Commerce 2.4.3 and earlier to ÃÛ¶¹ÊÓÆµ Commerce 2.4.4 or higher (when future versions are released).

Description description

Environment

  • ÃÛ¶¹ÊÓÆµ Commerce on premises, any version when updating to 2.4.4 or higher (when released)
  • ÃÛ¶¹ÊÓÆµ Commerce on cloud infrastructure, any version when updating to 2.4.4 or higher (when released)
  • Magento Open Source, any version when updating to 2.4.4 or higher (when released)

Issue/Symptoms

When updating to ÃÛ¶¹ÊÓÆµ Commerce 2.4.4 or higher after July 2022, you might get a warning from composer about plugins.

Steps to reproduce

Prerequisites: ÃÛ¶¹ÊÓÆµ Commerce 2.4.3 or earlier is installed.

  1. Start the upgrade as described in Perform an upgrade.
  2. Run the composer update command to upgrade the ÃÛ¶¹ÊÓÆµ Commerce application.

Expected results

Upgrade is successful.

Actual results

Installation fails with an error similar to the following:

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

Cause

After July 2022 Composer changes the default value of the to {} and plugins will not load anymore unless allowed.

Resolution resolution

  1. Add the following to your composer.jsonfile, depending on how you installed ÃÛ¶¹ÊÓÆµ Commerce:

    • If the project has been created using the composer create-project command:

      code language-none
      "config": {
          "allow-plugins": {
              "dealerdirect/phpcodesniffer-composer-installer": true,
              "laminas/laminas-dependency-plugin": true,
              "magento/*": true
          }
      }
      
      • If the project has been created by another way and does not have dealerdirect/phpcodesniffer-installer" in "require-devÌý²õ±ð³¦³Ù¾±´Ç²Ô:
      code language-none
      "config": {
          "allow-plugins": {
              "laminas/laminas-dependency-plugin": true,
              "magento/*": true
          }
      }
      
  2. After updating the composer.json file, run the composer update command and restart the upgrade process.

recommendation-more-help
3d58f420-19b5-47a0-a122-5c9dab55ec7f