Blog

Solved: Composer error in setup:upgrade command in Magento2

If you are stuck with composer error while running

php bin/magento setup:upgrade

this command in Magento2, not to worry at all. This article is here to help you out.

Error:-

Running data recurring...Reading C:\xampp\htdocs\magento/composer.json
Loading config file C:\xampp\htdocs\magento/composer.json
Failed to initialize global composer: Composer could not find the config file: C:/xampp/htdocs/magento/var/composer_home/composer.json
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
Reading C:\xampp\htdocs\magento/vendor/composer/installed.json
Reading C:\xampp\htdocs\magento/composer.lock
Checking for "magento/composer-root-update-plugin: 1.1.1" for the Web Setup Wizard...
Reading C:\xampp\htdocs\magento/var/vendor/magento/composer-root-update-plugin/composer.json Loading config file C:\xampp\htdocs\magento/var/vendor/magento/composer-root-update-plugin/composer.json No Web Setup Wizard update needed for magento/composer-root-update-plugin; version 1.1.1 is already in C:\xampp\htdocs\magento/var.

 

So lets go the solution-

Solution:-

To solve this problem, go to the root directory of magento2 ex. C:\xampp\htdocs\magento and then open composer file composer.json and remove the below module from it.

"magento/composer-root-update-plugin": "~1.1",

When you have removed above line from composer.json and after uploading file again and you need to run the below command:

composer update

When you will run this command it will update new changes done in composer.json to the composer.lock file and your issue will be fixed. Now, When you will run upgrade command in magento 2.4 everything will be run properly.

To install Magento 2.4.2 on Windows, please follow this link.

If you want us to help you, please feel free to comment below. Also let us know the feedback about this solution.

Happy Learning !!

Thank You !!

 

2 thoughts on “Solved: Composer error in setup:upgrade command in Magento2

  1. Failed opening required ‘C:\xampp\htdocs\magento2\vendor\composer/../phpstan/phpstan/bootstrap.php’ (include_path=’C:\xampp\htdocs\magento2\vendor/magento/zendframework1/library;C:\xampp\php\PEAR’) in C:\xampp\htdocs\magento2\vendor\composer\autoload_real.php on line 73

    error please suggest

Leave a Reply

Your email address will not be published. Required fields are marked *