cancel
Showing results for 
Search instead for 
Did you mean: 

Exclude module from sampledata installation command

SOLVED

Exclude module from sampledata installation command

Hi all,

I'm trying to install the sample data throught the command:

 

php bin/magento sampledata:deploy

But I get this error:

 

 [ErrorException]
  file_get_contents(/var/www/clients/client1/web16/web/app/code/Smartwave/Porto/composer.json):

Is there a way to exclude this theme-module from the command scope of execution?

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Exclude module from sampledata installation command

I resolved creating composer.json file empty everywhere was requested.

 

Then i modified composer.json in my root directory adding:

 

"require": {
        "magento/product-community-edition": "2.0.2",
        "composer/composer": "@alpha",
        "magento/module-bundle-sample-data": "100.0.*",
        "magento/module-widget-sample-data": "100.0.*",
        "magento/module-theme-sample-data": "100.0.*",
        "magento/module-catalog-sample-data": "100.0.*",
        "magento/module-customer-sample-data": "100.0.*",
        "magento/module-cms-sample-data": "100.0.*",
        "magento/module-catalog-rule-sample-data": "100.0.*",
        "magento/module-sales-rule-sample-data": "100.0.*",
        "magento/module-review-sample-data": "100.0.*",
        "magento/module-tax-sample-data": "100.0.*",
        "magento/module-sales-sample-data": "100.0.*",
        "magento/module-grouped-product-sample-data": "100.0.*",
        "magento/module-downloadable-sample-data": "100.0.*",
        "magento/module-msrp-sample-data": "100.0.*",
        "magento/module-configurable-sample-data": "100.0.*",
        "magento/module-product-links-sample-data": "100.0.*",
        "magento/module-wishlist-sample-data": "100.0.*",
        "magento/module-swatches-sample-data": "100.0.*",
        "magento/sample-data-media": "100.0.*",
        "magento/module-offline-shipping-sample-data": "100.0.*"
    },

then i re-run:

composer update

And then:

 

 php bin/magento setup:upgrade

This command gave me a problem with Area code variabile not initialized.

 

 

 

I resolved following this comment on github: https://github.com/magento/magento2/issues/1405

 

I added this lines in ./vendor/magento/framework/App/State.php

 public function getAreaCode()
    {
        if (!isset($this->_areaCode)) {
            /*throw new \Magento\Framework\Exception\LocalizedException(
                new \Magento\Framework\Phrase('Area code is not set')
            );*/
                $this->_areaCode="adminhtml";
        }
        return $this->_areaCode;
    }

After installing was finished I removed the comment of the throw of the exception and I comment the initialization instruction.

This method worked worked for me, however I don't know if was the right way to resolve the problem and if it will generate problem in future.

 

 

View solution in original post

1 REPLY 1

Re: Exclude module from sampledata installation command

I resolved creating composer.json file empty everywhere was requested.

 

Then i modified composer.json in my root directory adding:

 

"require": {
        "magento/product-community-edition": "2.0.2",
        "composer/composer": "@alpha",
        "magento/module-bundle-sample-data": "100.0.*",
        "magento/module-widget-sample-data": "100.0.*",
        "magento/module-theme-sample-data": "100.0.*",
        "magento/module-catalog-sample-data": "100.0.*",
        "magento/module-customer-sample-data": "100.0.*",
        "magento/module-cms-sample-data": "100.0.*",
        "magento/module-catalog-rule-sample-data": "100.0.*",
        "magento/module-sales-rule-sample-data": "100.0.*",
        "magento/module-review-sample-data": "100.0.*",
        "magento/module-tax-sample-data": "100.0.*",
        "magento/module-sales-sample-data": "100.0.*",
        "magento/module-grouped-product-sample-data": "100.0.*",
        "magento/module-downloadable-sample-data": "100.0.*",
        "magento/module-msrp-sample-data": "100.0.*",
        "magento/module-configurable-sample-data": "100.0.*",
        "magento/module-product-links-sample-data": "100.0.*",
        "magento/module-wishlist-sample-data": "100.0.*",
        "magento/module-swatches-sample-data": "100.0.*",
        "magento/sample-data-media": "100.0.*",
        "magento/module-offline-shipping-sample-data": "100.0.*"
    },

then i re-run:

composer update

And then:

 

 php bin/magento setup:upgrade

This command gave me a problem with Area code variabile not initialized.

 

 

 

I resolved following this comment on github: https://github.com/magento/magento2/issues/1405

 

I added this lines in ./vendor/magento/framework/App/State.php

 public function getAreaCode()
    {
        if (!isset($this->_areaCode)) {
            /*throw new \Magento\Framework\Exception\LocalizedException(
                new \Magento\Framework\Phrase('Area code is not set')
            );*/
                $this->_areaCode="adminhtml";
        }
        return $this->_areaCode;
    }

After installing was finished I removed the comment of the throw of the exception and I comment the initialization instruction.

This method worked worked for me, however I don't know if was the right way to resolve the problem and if it will generate problem in future.