How to fix failed Magento 2 download caused by changes in Composer
If your Magento 2 download was interrupted by ErrorException, you’ve come to the right place. In this article, we shed light on a problem when a download fails due to Composer changes. Below, you can see the description of the problem and its possible solution. More Magento 2 tips and tricks are gathered in our Developer’s Cookbook.
The Issue
You may face the following error during the Magento 2 download:
1 2 3 |
[ErrorException] file_get_contents(app/etc/NonComposerComponentRegistration.php): failed to open stream: No such file or directory |
The problem usually occurs in specific Composer versions. Since they contain some changes, the download procedure cannot run correctly. So, how to solve the issue when the Magento 2 download fails due to changes in Composer?
The Solution
As you might have already guessed, the workaround is quite simple: you need a correct Composer version. Usually, downgrading the tool to an earlier release helps. After you get the necessary version, rerun your Magento 2 download.
Problematic Composer versions
You may experience the problem with any Composer version dated between November 21 and November 26, 2015.
Let’s see how to find out the Composer version. Utilize the following command:
1 |
composer -v |
A message similar to the following one should appear:
1 |
Composer version 1.0-dev (2b14f0a047dd4f3545ec82381f65c36ea93a4c81) 2015-11-25 17:13:09 |
As you can see, we have to deal with the Composer version dated to November 25, 2015 (2015-11-25). Thus, it doesn’t let you download Magento 2 correctly. The workaround is the following:
- First of all, you need to get another Composer version. It is possible to downgrade the tool with the help of the following command:
1composer self-update 1.0.0-alpha11
Alternatively. You can upgrade Composer. Use the command below:
1composer self-update - After the Composer version is suitable for the Magento 2 download, it is necessary to delete the Magento 2 directory and subdirectories.
- Next, you can rerun the Magento 2 download. Use this command:
1composer create-project
You can also rely on the following one:
1git clone
When the Magento 2 software is successfully downloaded, you can update Composer once again:
1 |
composer self-update |
Follow this link to get more information: