2

PHP version: 8.1

composer: 2.2.0

Trying to fresh installed Magento open source 2.4.6 using the below command

composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition=2.4.6 magento246

and getting the below error:

 - Installing composer/pcre (3.1.0): Extracting archive
  - Installing composer/class-map-generator (1.0.0): Extracting archive
  - Installing composer/metadata-minifier (1.0.0): Extracting archive
  - Installing composer/spdx-licenses (1.5.7): Extracting archive
  - Installing squizlabs/php_codesniffer (3.7.2): Extracting archive
  - Installing dealerdirect/phpcodesniffer-composer-installer (v0.7.2): Extracting archive
Plugin initialization failed (require(app/etc/NonComposerComponentRegistration.php): Failed to open stream: No such file or directory), uninstalling plugin
  - Removing dealerdirect/phpcodesniffer-composer-installer (v0.7.2)
    Install of dealerdirect/phpcodesniffer-composer-installer failed

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

create-project [-s|--stability STABILITY] [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--repository REPOSITORY] [--repository-url REPOSITORY-URL] [--add-repository] [--dev] [--no-dev] [--no-custom-installers] [--no-scripts] [--no-progress] [--no-secure-http] [--keep-vcs] [--remove-vcs] [--no-install] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--ask] [--] [<package>] [<directory>] [<version>]

Error message:

    Plugin initialization failed (require(app/etc/NonComposerComponentRegistration.php): Failed to open stream: No such file or directory), uninstalling plugin
  - Removing dealerdirect/phpcodesniffer-composer-installer (v0.7.2)
    Install of dealerdirect/phpcodesniffer-composer-installer failed

                                                                                                           
  [ErrorException]                                                                                         
  require(app/etc/NonComposerComponentRegistration.php): Failed to open stream: No such file or directory  
                                                                                                           
1
  • May i suggest you to check the permissions ? Jun 11 at 17:57

2 Answers 2

1

To fix this issue, you can create an empty app/etc/NonComposerComponentRegistration.php file in your Magento installation.

1
  • thanks but i donot think it right idea as this file Magento will create automatically
    – Amit Bera
    Jun 11 at 11:41
1

The issue has been resolved after upgrading the composer version to the latest.

sudo composer selfupdate --2
composer -v


   ______
  / ____/___  ____ ___  ____  ____  ________  _____
 / /   / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
                    /_/
Composer version 2.5.8 2023-06-09 17:13:21

I think the issue is with the More secure plugin execution concept of the composer.

allow-plugins is used on mqagento composer.json for secure magento code and composer 2.2.0 version might has some issue that why the issue happen.

see

"allow-plugins": {
    "dealerdirect/phpcodesniffer-composer-installer": true,
    "laminas/laminas-dependency-plugin": true,
    "magento/*": true,
    "php-http/discovery": true
},

Your Answer

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

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