magento2: Magento 2.3.0: After composer installation sampledata can't be installed from command line
Preconditions
- Magento 2.3.0
- Install Magento with composer
- Remove the version number from the composer.json file in the root of the project.
Steps to reproduce
- Install Magento with composer using the following command
composer create-project --repository=https://repo.magento.com/ magento/project-community-edition <install-directory-name> - After successful installation and setup run the following command to install the sample data:
bin/magento sampledata:deploy
Expected result
- Sample data deploys to the freshly installed Magento environment.
Actual result
- 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.

About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 2
- Comments: 19 (16 by maintainers)
Commits related to this issue
- Fixed issue #19481: Magento 2.3.0: After composer installation sampledata can't be installed from command line — committed to andrewbess/magento2ce by andrewbess 4 years ago
- ENGCOM-7219: Fixed issue #19481: After composer installation sample data can't be installed from command line #27481 - Merge Pull Request magento/magento2#27481 from andrewbess/magento2:issue-19481 ... — committed to magento/magento2 by magento-engcom-team 4 years ago
- ENGCOM-7219: Fixed issue #19481: After composer installation sample data can't be installed from command line #27481 — committed to magento/magento2 by slavvka 4 years ago
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 @dverkade. Thanks for the report. I’m not able to reproduce following steps you described. Please see attachment of screen: