title: Magento 2 - 'Area code not set:' after adding sample data
body: <p>So i've gotten magento 2 working all running fine, I've even started on my own theme, but i've tried to install the sample data after I've installed magento. And it has returned 'Area code not set:' in terminal, below is a little run through of my steps.</p>
  
  <pre><code>bin/magento sampledata:deploy    
  composer update
  </code></pre>
  
  <p>Which returns:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>I've then run:</p>
  
  <pre><code>bin/magento setup:upgrade
  </code></pre>
  
  <p>And i get the following error shown in a screen shot below, i can't seem to find anyone else having the same error online.</p>
  
  <p><a href="https://i.stack.imgur.com/33pDy.png" rel="noreferrer"><img src="https://i.stack.imgur.com/33pDy.png" alt="terminal window of Area code not set:"></a></p>
  
  <pre><code>  [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    
  </code></pre>
  
  <p>And now my mage install just isn't working - error returns:</p>
  
  <p>Please upgrade your database: Run "bin/magento setup:upgrade" from the Magento root directory. </p>
  
  <p>Which I can't do because it returns and error, any help would be awesome.</p>