Magento – Magento 2 – Error importing sample data

luma-thememagento2sample-data

I just installed Magento 2.1.6, also installed Composer. When I tried to import the sample data, it gave me error of Installation Failed mentioning possible causing:

  • A typo in the package name
  • The package is not available in stable enough version.

LUMA theme is activated, and now when I run the project in browser, it shows the header, top menu with categories and footer, whereas the homepage middle section is blank. I can browse through the categories, Listing page and detail page (No images are shown).

Please guide me, what I'm missing or which direction I've to move to make the home page content and images viewable.

Best Answer

Please follow following steps to install sample data for magento 2.

  1. Add dependencies to the composer.json:

    composer require magento/module-bundle-sample-data:100.1.0 magento/module-widget-sample-data:100.1.0 magento/module-theme-sample-data:100.1.0 magento/module-catalog-sample-data:100.1.0 magento/module-customer-sample-data:100.1.0 magento/module-cms-sample-data:100.1.0  magento/module-catalog-rule-sample-data:100.1.0 magento/module-sales-rule-sample-data:100.1.0 magento/module-review-sample-data:100.1.0 magento/module-tax-sample-data:100.1.0 magento/module-sales-sample-data:100.1.0 magento/module-grouped-product-sample-data:100.1.0 magento/module-downloadable-sample-data:100.1.0 magento/module-msrp-sample-data:100.1.0 magento/module-configurable-sample-data:100.1.0 magento/module-product-links-sample-data:100.1.0 magento/module-wishlist-sample-data:100.1.0 magento/module-swatches-sample-data:100.1.0 magento/sample-data-media:100.1.0 magento/module-offline-shipping-sample-data:100.1.0 --no-update
    
  2. Run:

    composer update
    
  3. Deploy sample data:

    bin/magento sampledata:deploy
    
  4. Enable sample data modules:

    bin/magento module:enable Magento_CustomerSampleData Magento_MsrpSampleData Magento_CatalogSampleData Magento_DownloadableSampleData Magento_OfflineShippingSampleData Magento_BundleSampleData Magento_ConfigurableSampleData Magento_ThemeSampleData Magento_ProductLinksSampleData Magento_ReviewSampleData Magento_CatalogRuleSampleData Magento_SwatchesSampleData Magento_GroupedProductSampleData Magento_TaxSampleData Magento_CmsSampleData Magento_SalesRuleSampleData Magento_SalesSampleData Magento_WidgetSampleData Magento_WishlistSampleData
    
  5. Remove old files:

    rm -rf var/cache/* var/page_cache/* var/generation/*
    
  6. Upgrade magento files:

    bin/magento setup:upgrade
    
  7. Recompile files:

    bin/magento setup:di:compile
    
  8. Do reindex:

    bin/magento indexer:reindex
    
  9. Deploy static content:

    bin/magento setup:static-content:deploy
    

I tried it few days back and it worked without issue.

Source: https://stackoverflow.com/questions/32668486/magento2-how-to-install-sample-data-after-magento-setup/38240597#38240597

Related Topic