magento/magento2-sample-data

Fatal error when installing sample data from CLI

Opened this issue · 4 comments

Hello.

I've run into the following error when trying to install sample data from CLI in Magento 2.1.5 CE. This error occurs when running php bin/magento setup:upgrade, the first command php bin/magento sampledata:deploy executed with no problems.

Module 'Magento_SalesSampleData':
Installing data... PHP Fatal error:  Uncaught Error: Call to a member function getDataByKey() on null in /var/www/dysandbox/public_html/htdocs/vendor/magento/module-sales-sample-data/Model/Order/Converter.php:191
Stack trace:
#0 /var/www/dysandbox/public_html/htdocs/vendor/magento/module-sales-sample-data/Model/Order/Converter.php(171): Magento\SalesSampleData\Model\Order\Converter->getProductAttributes(Array)
#1 /var/www/dysandbox/public_html/htdocs/vendor/magento/module-sales-sample-data/Model/Order/Converter.php(76): Magento\SalesSampleData\Model\Order\Converter->convertProductData(Array)
#2 /var/www/dysandbox/public_html/htdocs/vendor/magento/module-sales-sample-data/Model/Order.php(101): Magento\SalesSampleData\Model\Order\Converter->convertRow(Array)
#3 /var/www/dysandbox/public_html/htdocs/vendor/magento/module-sales-sample-data/Setup/Installer.php(30): Magento\SalesSampleData\Model\Order->install(Array)
#4 [internal function]: Magento\SalesSampleData\Setup\Installer->install()
#5 /var/www/dysandbox/public_html/htdocs/vendor/magento/frame in /var/www/dysandbox/public_html/htdocs/vendor/magento/module-sales-sample-data/Model/Order/Converter.php on line 191

Thanks in advance.

Worked around it by creating an upgrade script, which adds two product attribute options:

  • option "size" with value "XS"
  • option "color" with value "Red" (mind the capitalization, there was already an option with value "red" in the database, but it still threw the same error)

It looks like the issue is the fixtures/orders.csv file is not serialized when the code is expecting it to be.

I had this issue and was able to resolve it by following this stackexchange post
https://magento.stackexchange.com/questions/144042/complete-the-sample-data-installation-error

The issue was related to the CRLF file endings

Hello @jjewel - this is not working after apply your suggesting in windows
#mm19in
Thank you