Magento2: magento 2.0.7 sampledata:deploy|remove fatal error

Created on 25 May 2016  路  16Comments  路  Source: magento/magento2

Hi.
I've updated magento from 2.0.4 to 2.0.7 via composer.
And then I tried to remove sample data using CLI and got following error.

php70 bin/magento sampledata:remove
PHP Fatal error: Uncaught TypeError: Argument 1 passed to Symfony\Component\Console\InputArrayInput::__construct() must be of the type array, object given, called in /srv/mat24/web/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 97 and defined in /srv/mat24/web/vendor/symfony/console/Symfony/Component/Console/Input/ArrayInput.php:37
Stack trace:

0 /srv/mat24/web/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(97): Symfony\Component\Console\InputArrayInput->__construct(Object(Magento\Framework\ObjectManager\ObjectManager))

1 /srv/mat24/web/vendor/magento/framework/ObjectManager/Factory/Compiled.php(88): Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject('Symfony\Compone...', Array)

2 /srv/mat24/web/vendor/magento/framework/ObjectManager/ObjectManager.php(57): Magento\Framework\ObjectManager\Factory\Compiled->create('Symfony\Compone...', Array)

3 /srv/mat24/web/var/generation/Symfony/Component/Console/Input/ArrayInputFactory.php(43): Magento\Framework\Obje in /srv/mat24/web/vendor/symfony/console/Symfony/Component/Console/Input/ArrayInput.php on line 37

Sorry, don't sure whether if it is issue or not. Maybe someone already solved such case.

Ready for Work needs update

All 16 comments

Sampledata is, at best said lottery. It can break your entire Magento2 instance at any time.

You can first try to:

module:uninstall                         
module:disable

any sampledata modules.

Then run setup:upgrade

@stamster, uh, thats right) I tried to do so - uninstalling all of those modules and one by one, but everytime after console had wrote "Removing code from Magento codebase:" and nothing happened during a half of hour... Well, I decided to reinslall magento. It's much efficient and much faster as well. :) Maybe the problem is in server configuration.

@antonlazarchenko , try to clean your var/generation directory.
rm -Rf <magento_root>/var/generation/*

@rganin, already tried but nothing. I cleaned /di and /generation, did setup:di:compile, setup:upgrade. Nothing.

@stamster @antonlazarchenko we have created MAGETWO-53496 to investigate and fix module:uninstall, and MAGETWO-53497 to investigate and fix sampledata:remove

@aabumuslimov I have not been able to recreate both issues related to sampledata:remove and module:uninstall Can you please make sure your file permissions are as expected?

@aabumuslimov how did you initially deploy Magento? via composer create project? via git or via zip downloaded from magento.com?

@mazhalai, file permissions is ok. According to deployment: firstly git pull, then composer install, then via browser did setup process.

@antonlazarchenko what about steps for I've updated magento from 2.0.4 to 2.0.7 via composer. How did you do that? was that git based?

@mazhalai, I've updated actually /app/code folder with it's modules by git. So /vendor changed by composer.

@antonlazarchenko so you checked out tag 2.0.7? or latest from develop?

@antonlazarchenko how exactly did you update app/code? physically copy files?

I tried the following steps and cannot reproduce your error:

  • git checkout tag/2.0.4 -b 2.0.4
  • install
  • bin/magento sampledata:deploy
  • bin/magento setup:upgrade
  • git commit your changes since composer.json and lock were updated.
  • git checkout tag/2.0.7 -b 2.0.7
  • composer update (this removes the sample data modules from vendor, since the git version of 2.0.7 composer.json does not have sample-data by default.
  • bin/magento setup:upgrade
  • bin/magento sampledata:remove gives error for each of the packages "Package "magento/module-wishlist-sample-data" listed for update is not installed. Ignoring."

Yeah, some errors of this kind are hard to reproduce. Often I wonder what in the world could cause so much damage to bring your entire instance down. Trying the same on the exact same vritual server works. But, it's not that simple as while in a development process you configure various things.

Personally, I would (I did) avoid sample data at all costs if you need to develop on Magento2. It can cause you so much pain. Not that Magento2 is any better, but at least we remove overhead as much as we can.

@mazhalai, I did approximately following on remote server:

  • git pull origin mybranch (as i said - there is my composer, app/code, etc)
  • composer install
  • web/setup via browser interface ising a private tab
  • bin/magento setup:static-content:deploy en_US
  • bin/magento setup:di:compile
    Then I successfully removed sampledata locally "sampledata:remove", made commit and push to git.
  • remote - git pull
  • composer update
  • bin/magento sampledata:remove
    And then saw that error "PHP Fatal error: Uncaught TypeError"

That was the steps as I remembered them. For now I haven't possibility to check.

@stamster, thanx. Recommendation accepted)

@antonlazarchenko After composer update, you need to run bin/magento setup:upgrade

According to contributor guide, tickets without response for two weeks should be closed.
Please feel free to reopen if it's needed.

Was this page helpful?
0 / 5 - 0 ratings