Magento 2 Troubleshooting: How to resolve file_get_contents /var/di/setup.ser failed to open stream

I installed a blog extension and a custom module and received this warning when trying to run a Magento 2.0 upgrade:

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

Failed solution 1:
1) Clear all of the dynamically created folders with: rm -rf var/di/ var/generation/* var/cache/* var/page_cache/* var/view_preprocessed/* var/composer_home/cache/*
2) magento setup:upgrade
3) results in error

Failed solution 2:
1) Create a custom module based off the fix found in this Magento 2 forum.
2) I’m not sure if this or the module I was trying to upload killed access to my admin panel.

Successful solution:
All of the contents of the /var/di folder have to be completely cleared before being rebuilt or else a conflict in versions would arise.  To remove the folder: rm -rf var/di

2 thoughts on “Magento 2 Troubleshooting: How to resolve file_get_contents /var/di/setup.ser failed to open stream”

Comments are closed.