Magento 2 - 添加示例数据后“未设置区号:”

所以我已经让magento 2运行良好,我甚至开始了自己的主题,但我在安装magento后尝试安装示例数据。它在终端中返回了“未设置区号:”,以下是我的步骤。

bin/magento sampledata:deploy    
composer update

这将返回:

Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Installing magento/module-catalog-sample-data (100.0.3)
    Downloading: 100%         

  - Installing magento/module-bundle-sample-data (100.0.3)
    Downloading: 100%         

  - Installing magento/module-widget-sample-data (100.0.3)
    Downloading: 100%         

  - Installing magento/module-customer-sample-data (100.0.3)
    Downloading: 100%         

  - Installing magento/sample-data-media (100.0.3)
    Downloading: 100%         

  - Installing magento/module-theme-sample-data (100.0.3)
    Downloading: 100%         

  - Installing magento/module-cms-sample-data (100.0.3)
    Downloading: 100%         

  - Installing magento/module-catalog-rule-sample-data (100.0.3)
    Downloading: 100%         

  - Installing magento/module-sales-rule-sample-data (100.0.3)
    Downloading: 100%         

  - Installing magento/module-review-sample-data (100.0.3)
    Downloading: 100%         

  - Installing magento/module-tax-sample-data (100.0.3)
    Downloading: 100%         

  - Installing magento/module-grouped-product-sample-data (100.0.3)
    Downloading: 100%         

  - Installing magento/module-downloadable-sample-data (100.0.3)
    Downloading: 100%         

  - Installing magento/module-msrp-sample-data (100.0.3)
    Downloading: 100%         

  - Installing magento/module-sales-sample-data (100.0.3)
    Downloading: 100%         

  - Installing magento/module-product-links-sample-data (100.0.3)
    Downloading: 100%         

  - Installing magento/module-configurable-sample-data (100.0.3)
    Downloading: 100%         

  - Installing magento/module-wishlist-sample-data (100.0.3)
    Downloading: 100%         

  - Installing magento/module-swatches-sample-data (100.0.3)
    Downloading: 100%         

  - Installing magento/module-offline-shipping-sample-data (100.0.3)
    Downloading: 100%         

Writing lock file
Generating autoload files

然后我运行:

bin/magento setup:upgrade

我在下面的屏幕截图中得到了以下错误,我似乎找不到其他人在网上有同样的错误。

terminal window of Area code not set:

  [Magento\Framework\Exception\SessionException]                       
  Area code not set: Area code must be set before starting a session.  

  [Magento\Framework\Exception\LocalizedException]  
  Area code is not set    

现在我的法师安装不起作用 - 错误返回:

请升级您的数据库:从Magento根目录运行“bin/magento setup:upgrade”。

我不能这样做,因为它返回和错误,任何帮助都会很棒。


答案 1

有同样的问题,能够解决它。

请先尝试运行以下命令:

php bin/magento sampledata:reset

然后重新运行:

php bin/magento setup:upgrade

如果您遇到内存耗尽错误(我遇到过),请尝试在命令上添加。-dmemory_limit=6Gsetup:upgrade

php -dmemory_limit=6G bin/magento setup:upgrade

答案 2

请先尝试运行以下命令:

php bin/magento app:config:import

,然后清除缓存并运行 setup:upgrade


推荐