3

I'm currently facing an important issue when i want to run any "php bin/console" command:

Symfony\Component\ErrorHandler\Error\ClassNotFoundError^ {#29
#message: """
    Attempted to load class "Kernel" from namespace "App".\n
    Did you forget a "use" statement for "Symfony\Component\HttpKernel\Kernel"?
    """
  #code: 0
  #file: "./bin/console"
  #line: 41
}
2020-06-11T15:43:20+00:00 [critical] Uncaught Error: Class 'App\Kernel' not found

While my Kernel.php class is normally defined in src/Kernel.php

I am working with Symfony 5

LenaHic
  • 91
  • 1
  • 5
  • 2
    You could try a "composer dump-autoload". Seems like your autoloading is not setup. Which is odd. – Cerad Jun 11 '20 at 16:00
  • 3
    There was a bug in a minor Symfony 5.0. This bug gave this kind of strange issue with composer autoloader when there was a syntax error. I don't know if it is your problem but you could also try a composer update. – Florian Hermann Jun 11 '20 at 16:05
  • This bug still exists in Symfony 5.2 – Acyra Jan 16 '21 at 12:18

1 Answers1

5

I manage to solve my issue performing 3 successive actions :

  1. delete "vendor" folder (I saved it in another folder just in case)

  2. delete "cach-dev" folder

  3. run "composer update" command

Hope it can help other people to solve their issue

LenaHic
  • 91
  • 1
  • 5