8

This is killing me.

When I run bin/magento setup:upgrade it throws this:

Warning: include(/vendor/composer/../../generated/code/Magento/Framework/App/Config/InitialConfigSource/Proxy.php): failed to open stream: No such file or directory in /vendor/composer/ClassLoader.php on line 444

And when I run bin/magento setup:di:compile it throws this:

Class Magento\Framework\App\ResourceConnection\Proxy does not exist

Site was running perfectly. I had run setup:upgrade before without any problem. I had also ran di:compile.

But today, all of sudden this is happening.

Any idea?

UPDATE

I used to follow this every time when I compile: https://devdocs.magento.com/guides/v2.3/performance-best-practices/deployment-flow.html

Could it be the reason now that I cannot run bin/magento setup:upgrade or bin/magento setup:di:compile?

I remember, at first running bin/magento setup:upgrade it threw error, after that I am stuck, couldn't run any CLI commands.

UPDATE 2

On first run setup:upgrade, it threw an error. Unfortunately I did not make a note of that and re-run the setup:upgrade again. Since then the above-mentioned error is thrown.

UPDATE 3

Alright, so in my local instance, I was able to reproduce a similar error. It's slightly different than what I was getting in my live server:

Warning: include(/vendor/composer/../../generated/code/Magento/Framework/App/ResourceConnection/Proxy.php): failed to open stream: No such file or directory in /vendor/composer/ClassLoader.php on line 444

So, after I ran composer update It did allow me to run Magento CLI commands. And I was able to compile.

I still want to understand this. I am yet to perform this into my live server.

Adarsh Khatri
  • 8,360
  • 2
  • 25
  • 58

4 Answers4

15

I solved simply by composer:

composer dumpautoload
WaPoNe
  • 1,590
  • 3
  • 17
  • 35
3

If you use dockergento try

dockergento composer dump-autoload
 docker exec -it -u 0 hp_redis_1 bash

Then inside

redis-cli flushall
exit

and then run setup:upgrade . If you don't use dockergento it might be something similar for bin magento. first try bin/magento composer dump-autoload.

Giga Todadze
  • 138
  • 14
3

I would suggest to run update composer. Please follow the below command.

composer update

php bin/magento cache:flush and cache:clean

php bin/magento setup:upgrade

Hope this will help you.

Nits
  • 2,496
  • 1
  • 8
  • 21
1

You are running composer or magento commands with root user (sudo), just fix the permissions and the owners of your magento files and directories (fix the generated directory and remove its content)

After fixing the owner here is a good answer for the permissions

laurent
  • 111
  • 3