Magento 2 - Error Running Setup:upgrade

When trying to update a Magento 2 database recently using:

php bin/magento setup:upgrade

I also tried:

php bin/magento setup:upgrade --keep-generated

I got the following error:

  [Exception]                                                                             
  Warning: file_get_contents(.../var/di/setup.ser): failed to open   
  stream: No such file or directory in .../vendor/magento/framework  
  /App/ObjectManager/ConfigLoader/Compiled.php on line 28

It looks like a regression was introduced in 2.1.0 that stops you running setup:upgrade after running setup:di:compile. A temporary fix for this is to remove all contents from var/di and var/generation, run the update and then re-compile.

This has been fixed in Magento 2.1.1 and is detailed in this github issue.


Tags: magento2cli