Magento2: Magento 2.3.0: After composer installation sampledata can't be installed from command line

Created on 30 Nov 2018  路  19Comments  路  Source: magento/magento2

Preconditions

  1. Magento 2.3.0
  2. Install Magento with composer
  3. Remove the version number from the composer.json file in the root of the project.

Steps to reproduce

  1. Install Magento with composer using the following command composer create-project --repository=https://repo.magento.com/ magento/project-community-edition <install-directory-name>
  2. After successful installation and setup run the following command to install the sample data: bin/magento sampledata:deploy

Expected result

  1. Sample data deploys to the freshly installed Magento environment.

Actual result

  1. Command throws the following error:
bin/magento sampledata:deploy
Git installations must deploy sample data from GitHub; see https://devdocs.magento.com/guides/v2.3/install-gde/install/sample-data-after-clone.html for more information.

image

SampleData Fixed in 2.4.x Clear Description Confirmed Format is valid Ready for Work P2 Reproduced on 2.3.x S1 Done

Most helpful comment

I did some more digging into this issue and found out why it's not installing for me. My root composer.json does not have a version number in it. The command sampledata:deploy is checking if there is a version number present in the root composer.json file. When a version number is not found / present it will throw the error shown in this issue. This happens on the following line in the code:
https://github.com/magento/magento2/blob/2.3-develop/app/code/Magento/SampleData/Console/Command/SampleDataDeployCommand.php#L87

Please note that according to the Composer documentation, the version number is not required and should be omitted. More information here:
https://getcomposer.org/doc/04-schema.md#version
The documentation also states: Specifying the version yourself will most likely end up creating problems at some point due to human error.

So a better solution is the check if the file /app/code/Magento/SampleData/composer.json file exists in order to determine if the installation is installed with composer or cloned from Github.

All 19 comments

Hi @dverkade. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • [x] Summary of the issue
  • [x] Information on your environment
  • [x] Steps to reproduce
  • [x] Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento-engcom-team give me $VERSION instance

where $VERSION is version tags (starting from 2.2.0+) or develop branches (for example: 2.3-develop).
For more details, please, review the Magento Contributor Assistant documentation.

@dverkade do you confirm that you was able to reproduce the issue on vanilla Magento instance following steps to reproduce?

  • [x] yes
  • [ ] no

Hi @engcom-backlog-andrii. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

  • [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.
  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • [ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • [ ] 4. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!

  • [ ] 5. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

  • [ ] 6. Add label Issue: Confirmed once verification is complete.

  • [ ] 7. Make sure that automatic system confirms that report has been added to the backlog.

@dverkade what is not clear here? :) Such installation is really not a Composer-based but something similar to git clone.

You can use Composer to create new projects from an existing package. This is the equivalent of doing a git clone/svn checkout followed by a composer install of the vendors.

@orlangur Look at the DevDocs here: https://devdocs.magento.com/guides/v2.3/install-gde/composer.html

It clearly states that you are installing with composer (it's in the title). Then when you install the sample data it says that it's installed with GIT. So totally not clear and sampledata should be able to install when you follow the steps from the DevDocs documentation, which was working correctly in Magento 2.2.X by the way.

The DevDocs documentation of installing the sample data referenced by the error message (https://devdocs.magento.com/guides/v2.3/install-gde/install/sample-data-after-clone.html ) clearly states that this only works when: "You cloned the Magento 2 repository." By following the steps described in this issue, this is clearly not the case it was not cloned, but installed with Composer.

@dverkade sorry, you're right, I misread the installation command. magento/project-community-edition is a right package for Composer-based installation.

Hi @dverkade. Thanks for the report. I'm not able to reproduce following steps you described. Please see attachment of screen:
composer-sd

Also happens with "magento/product-enterprise-edition": "2.3.0" specified in my composer.json, using php 7.2 and composer 1.7.3.

Meta: What's with that mentality? Can't reproduce, can't be a bug -- so let's just close it?
I'll try to investigate when I've got some spare time, currently I'm low on time (due to issues like this).

EDIT: Formatting consistency

I did some more digging into this issue and found out why it's not installing for me. My root composer.json does not have a version number in it. The command sampledata:deploy is checking if there is a version number present in the root composer.json file. When a version number is not found / present it will throw the error shown in this issue. This happens on the following line in the code:
https://github.com/magento/magento2/blob/2.3-develop/app/code/Magento/SampleData/Console/Command/SampleDataDeployCommand.php#L87

Please note that according to the Composer documentation, the version number is not required and should be omitted. More information here:
https://getcomposer.org/doc/04-schema.md#version
The documentation also states: Specifying the version yourself will most likely end up creating problems at some point due to human error.

So a better solution is the check if the file /app/code/Magento/SampleData/composer.json file exists in order to determine if the installation is installed with composer or cloned from Github.

Hi @engcom-backlog-nazar. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

  • [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.
  • [x] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • [x] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • [x] 4. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!

  • [x] 5. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

  • [x] 6. Add label Issue: Confirmed once verification is complete.

  • [x] 7. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-backlog-nazar Thank you for verifying the issue. Based on the provided information internal tickets MAGETWO-97056 were created

@mbiberhofer,

Can't reproduce, can't be a bug -- so let's just close it?

Exactly. We cannot do anything about irreproducible bugs and this is absolutely okay. What's the problem in reopening bug when it can be actually reproduced?

Thanks @dverkade for figuring out a real cause and exact steps to reproduce. Would you mind to create a PR maybe?

@orlangur in my opinion checking if the file app/code/Magento/SampleData/composer.json exists would be the way to check it it's installed with composer or not? If that would be the way to go I can create a PR for this.

@dverkade how to distinguish when we have a fresh installation and there is no app/code/Magento/SampleData/composer.json yet?

@orlangur the Magento_SampleData module is part of the Magento core. It holds the console commands to install the sample data. So if we check if the file in this location is present: app/code/Magento/SampleData/composer.json We can be sure that Magento was installed doing a git clone.

@dverkade got it, I wasn't aware https://github.com/magento/magento2/tree/2.3-develop/app/code/Magento/SampleData is a part of main repo.

Yeah, please create a PR with such approach, it seems pretty reliable.

@orlangur Would a sufficient check be to check if app/code/Magento exists at all? (if it does, must be Git?)

Hi @andrewbess. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:

  • [ ] 1. Add/Edit Component: XXXXX label(s) to the ticket, indicating the components it may be related to.
  • [ ] 2. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!

  • [ ] 3. If the issue is not relevant or is not reproducible any more, feel free to close it.


Hey, folk. I want to try fixing it

Hi @dverkade. Thank you for your report.
The issue has been fixed in magento/magento2#27481 by @andrewbess in 2.4-develop branch
Related commit(s):

The fix will be available with the upcoming 2.4.1 release.

Was this page helpful?
0 / 5 - 0 ratings