I'm trying to remove the Sample Data from my M2 instance.

The sample data was installed at version 2.0.7, but the site has since been upgraded to version 2.1.

When I try to run php bin/magento sampledata:remove, I am just greeted with a blank prompt, but when I look at the PHP logs, I see this:

[06-Sep-2016 07:53:13 UTC] PHP Fatal error:  Uncaught TypeError: Argument 1 passed to Magento\Framework\Config\Composer\Package::__construct() must be an instance of stdClass, null given, called in /Applications/MAMP/htdocs/Site/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 93 and defined in /Applications/MAMP/htdocs/Site/vendor/magento/framework/Config/Composer/Package.php:26
Stack trace:
#0 /Applications/MAMP/htdocs/Site/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(93): Magento\Framework\Config\Composer\Package->__construct(NULL)
#1 /Applications/MAMP/htdocs/Site/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(89): Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject('Magento\\Framewo...', Array)
#2 /Applications/MAMP/htdocs/Site/vendor/magento/framework/ObjectManager/ObjectManager.php(57): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\\Framewo...', Array)
#3 /Applications/MAMP/htdocs/Site in /Applications/MAMP/htdocs/Site/vendor/magento/framework/Config/Composer/Package.php on line 26

Does anyone know how to manually remove the sample data, and can you pass that glimmer of hope my way?

1 Answer 1


According to the documentation: "There is currently no way to uninstall sample data. We recommend you use sample data only to learn about how Magento works. Avoid doing any development in a system in which you installed sample data."

UPDATE: Apparently this is no longer true as of v2.1.2. We are actively developing with the sample data (in fact, it has helped a lot), and when we pushed to our test environment we were able to successfully remove the sample data using magento sampledata:remove (just remember to recompile after).

  • Must have missed the bit about the sample data and development. Although I can see why they say that! Oct 4, 2016 at 15:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.