1

I'm unable to install the Magento 2 sample data via the CLI, this is after Magento 2 has already been installed. Currently on 2.1.1.

The steps I've taken:

  1. php bin/magento sampledata:deploy
  2. php bin/magento setup:upgrade

The setup:upgrade command fails with the following error:

...
Module 'Magento_GiftMessageStaging':
Module 'Magento_CatalogStaging':
Module 'Magento_GiftRegistrySampleData':
Installing data... PHP Fatal error:  Uncaught Error: Call to a member function getData() on boolean in /var/www/vhosts/projectname/production/htdocs/vendor/magento/module-gift-registry-sample-data/Model/GiftRegistry.php:192
Stack trace:
#0 /var/www/vhosts/projectname/production/htdocs/vendor/magento/module-gift-registry-sample-data/Model/GiftRegistry.php(144): Magento\GiftRegistrySampleData\Model\GiftRegistry->generateData(Array)
#1 /var/www/vhosts/projectname/production/htdocs/vendor/magento/module-gift-registry-sample-data/Setup/Installer.php(30): Magento\GiftRegistrySampleData\Model\GiftRegistry->install(Array)
#2 [internal function]: Magento\GiftRegistrySampleData\Setup\Installer->install()
#3 /var/www/vhosts/projectname/production/htdocs/vendor/magento/framework/App/State.php(171): call_user_func_array(Array, Array)
#4 /var/www/vhosts/projectname/production/htdocs/vendor/magento/framework/Setup/SampleData/Executor.php(50): Magento\Framework\App\State->emulateAreaCode('setup', Array)
#5 /var/www/vhosts/projectname/production/htdocs/vendor/magento/module in /var/www/vhosts/projectname/production/htdocs/vendor/magento/module-gift-registry-sample-data/Model/GiftRegistry.php on line 192

Does anyone know how this is resolved? I'm a front-end developer so I'm not too great at spotting the errors in PHP.

Thanks,

Ben

1

For some reason Magento didn't update the data_version row within the database, all the sample data was set to null. Manually changing these values to 2.0.0 has fixed the problem.

Still no idea what actually caused it though.

enter image description here

1

A suggested fix was posted in this thread.

https://github.com/magento/magento2-sample-data/issues/25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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