So I'm looking at my production environment, and I notice a whole bunch of Magento_%SampleData folders. If I try and run the magento sampledata:remove command, I get the error:

  Warning: file_get_contents(/home/public_html/app/code/Theme/Blog/c
  omposer.json): failed to open stream: No such file or directory in /home/public_html/vendor/magento/module-sample-data/Model/Dependency.php
   on line 109

However because, its a production environment, I cannot remove/change this extension for now But I was wondering if I manually disable and then remove the SampleData components, will this cause any problems?

If I go this route, how do I prevent composer from re-installing them in future upgrades?

2 Answers 2


Read the notice in the Dev Docs

uninstall sample data

You can disable those modules but an Uninstall is not possible. the DB will still contain references to them.


So it turns out all I needed to do was create a composer.json file for the offending module Theme/Blog/composer.json, and I was then able to run the sampledata:remove command. Which also updates the composer library and removes them from future downloads.

if you get an error when trying to run the command referencing invalid credentials, simply run:

`ln -s ~/.composer/auth.json var/composer_home/


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.