I tried to install Magento 2.4 via command line. It runs smooth until
[Progress: 653 / 1206]
Module 'Magento_ComposerRootUpdatePlugin':
At this step the installation fails with
Installing data... Reading /<magento_root>/composer.json
Loading config file /<magento_root>/composer.json
Failed to initialize global composer: Composer could not find the config file: /<magento_root>/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
Composer is installed globally. The Magento documentation does not mention anything else regarding composer.
Thank you very much.
-
Facing the Same Error Failed to initialize global composer: Composer could not find the config file: /Users/mac/sites/ewlicense/var/composer_home/composer.json To initialize a project, please create a composer.json file as described in the getcomposer.org "Getting Started" section I also tried composer self-update but it still not fixed the issue. the Url is giving me 502 Bag GatewayMuhammmd Ahmad Anwar– Muhammmd Ahmad Anwar2020年08月03日 13:27:20 +00:00Commented Aug 3, 2020 at 13:27
-
I'm facing the same issue...KaMZaTa– KaMZaTa2020年08月04日 00:10:56 +00:00Commented Aug 4, 2020 at 0:10
-
@hardy123480 Were you able to install Magento 2.4.0 even if it's shown this error?KaMZaTa– KaMZaTa2020年08月04日 12:52:42 +00:00Commented Aug 4, 2020 at 12:52
-
1Kind of. What I now tried is to install a local instance of composer in the Magnet root directory. It still throws the error but the installation goes through successfully. Unfortunately, I get 502 Bad Gateway if I want to access the frontend / backend. I'm running out of ideas.hardy123480– hardy1234802020年08月04日 13:11:52 +00:00Commented Aug 4, 2020 at 13:11
-
@hardy123480 which php version are you running? 7.4.8?KaMZaTa– KaMZaTa2020年08月04日 15:26:31 +00:00Commented Aug 4, 2020 at 15:26
4 Answers 4
Here's a workaround - after creating the project from magento Repo, create the composer.json file
cd var
mkdir composer_home
cd composer_home
vim composer.json
composer.json contents-
{
}
Hope this works for you
-
has you installed custom modules via composer in vendor source path ? and installed or register in magento ?Adrian R– Adrian R2021年07月07日 21:08:10 +00:00Commented Jul 7, 2021 at 21:08
I had the same problem. But it was solved by creating auth.json in var/composer_home like this
{
"http-basic": {
"repo.magento.com": {
"username": "your username key",
"password": "your password key"
}
}
}
@Gabriela
it works for me...but command prompt says
"Failed to initialize global composer: Composer could not find the config file: C:/xampp/htdocs/magento/var/composer_home/composer.json"
should i create composer.json instead of auth.json and add your mentioned code.
also please mention, which username and password should i add.
many thanks, rakshith
Installed 2.4 ok but got this same error running setup:upgrade. 2.4.x requires composer v2.
Run composer self-update --2 from appropriate account and issue should go away. If you get permission denied and can't elevate then your hosting company will need to do this.