Magento 2 - 添加样本数据后'区号未设置:'

and*_*nes 26 php magento composer-php magento2 magento-2.0

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

bin/magento sampledata:deploy    
composer update
Run Code Online (Sandbox Code Playgroud)

哪个回报:

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
Run Code Online (Sandbox Code Playgroud)

我然后运行:

bin/magento setup:upgrade
Run Code Online (Sandbox Code Playgroud)

我在下面的屏幕截图中显示以下错误,我似乎无法找到其他人在线有相同的错误.

未设置区号的终端窗口:

  [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    
Run Code Online (Sandbox Code Playgroud)

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

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

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

小智 47

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

首先尝试运行此命令:

php bin/magento sampledata:reset
Run Code Online (Sandbox Code Playgroud)

然后重新运行:

php bin/magento setup:upgrade
Run Code Online (Sandbox Code Playgroud)

如果你有一个内存耗尽的错误(我遇到过),尝试添加-dmemory_limit=6G在你的setup:upgrade命令.

php -dmemory_limit=6G bin/magento setup:upgrade
Run Code Online (Sandbox Code Playgroud)


小智 5

尝试先运行此命令:

php bin/magento app:config:import
Run Code Online (Sandbox Code Playgroud)

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