9

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.

3

4 Answers 4

4

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.

11
  • What are the autoloads? Is it safe to dump them? Commented Apr 13, 2020 at 3:51
  • just have exactly the same error i.imgur.com/JAwvpHJ.png it Generated autoload files containing 631 classes i.imgur.com/mf90Nst.png fixed. Commented Apr 13, 2020 at 11:17
  • Can you tell me what exactly did you do to run into this error? I want to understand what triggers this error. Commented Apr 13, 2020 at 12:05
  • Sure can. I run dockergento composer install --no-suggest -o --ignore-platform-reqs --prefer-dist and it updated some modules. Commented Apr 13, 2020 at 12:07
  • If it fixes an error and you accept my answer I'm gonna bounty my question ... I am so stucked magento.stackexchange.com/questions/310097/… Commented Apr 13, 2020 at 12:10
15

I solved simply by composer:

composer dumpautoload
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.

2
  • I know, like I said, I want to understand this. Why this happens, what are the causes? Commented Apr 12, 2020 at 22:00
  • Can you please let me know, your issue has been fixed using my solution or not?
    – Nits
    Commented Apr 13, 2020 at 10:29
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

1
  • There is no permission issue. I am running command same way I have been running, that is from magento user. Commented Apr 17, 2020 at 21:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.