Uncaught ReflectionException: Class log does not exist Laravel 5.2

前端 未结 25 1831
长情又很酷
长情又很酷 2020-11-27 17:15

I am currently trying to clone an existing project of mine from github. After clone I run composer install during the process I receive the following error:

相关标签:
25条回答
  • 2020-11-27 17:22

    I tried a lot of solutions provided here and elsewhere. It did not work for me. I solved it by manually removing /var/www/html/bootstrap/cache/compiled.php and updating the autoload files:

    rm /var/www/html/bootstrap/cache/compiled.php
    composer dump-autoload
    
    0 讨论(0)
  • 2020-11-27 17:22

    Since no one has mentioned orchestra/testbench yet I thought I'd just add the solution to my problem.

    I was writing a Laravel package when I got this error in one of my unit tests. I was using orchestra/testbench to enable testing of Laravel-specific parts of the code.

    The problem was simply that the test class was extending PHPUnit\Framework\TestCase instead of Orchestra\Testbench\TestCase.

    0 讨论(0)
  • 2020-11-27 17:24

    Just running

    composer update
    

    fixed the issue.

    0 讨论(0)
  • 2020-11-27 17:26

    I had the same issue and none of the solutions here worked out

    I've found that there's an exception of permission denied to config folder

    After fixing the permission everything worked!


    How to figure it?

    Put a break-point in vendor/laravel/framework/src/illluminate/Foundation/Http/Kernel.php

    line 101 inside the catch of the handle function.

    This is how I've found out about the permission denied.

    0 讨论(0)
  • 2020-11-27 17:28

    EDIT::

    Because I wasn't satisfied with the rather clumsy debugging and reworking paths, etc to get the VM running smoothly, I reflected on the process and reinstalled the vagrant box laravel/homestead (virtualbox 1.0.1)

    For me the issue potentially stemmed from a missing comma in config/app.php. The missing comma likely halted the compilation process and spit out the Uncaught ReflectionException: Class log does not exist error.


    This is not a direct answer, but serves more as a guide post to those who venture into this abyss of silent errors

    System: macOS Sierra

    Vagrant: 1.9.1 (Latest Version at time of writing)

    VM: laravel/homestead (virtualbox 0.4.0)

    Laravel Version: 5.1.*

    PHP: 7.0.*


    After repeated attempts to resolve the issue which include:

    1. rewriting, removing .env for potential parse issues
    2. php7.1 and the mcrypt / mbstring issues
    3. installing composer suggested packages
    4. updating homestead.rb
    5. PATH related issues

    Critically, (for me) it seemed it was the virtualbox version in the initial set up:

    vagrant box add laravel/homestead

    Instead try supplying the version number like so:

    vagrant box add laravel/homestead --box-version 0.4.0


    misc:

    I have attempted and failed with the following laravel/homestead virtualbox versions:

    • 1.0.1 (default)

    and laravel/homestead-7:

    • 0.2.1
    0 讨论(0)
  • 2020-11-27 17:28

    Also this is due to a syntax error in some file in the conf/ directory or .env file. In my case I got this error because I forget to put ::class at the end of the line when adding a service provider and facade, to the array providers and alises in conf/app.php file. I corrected this and the error disappeared.

    0 讨论(0)
提交回复
热议问题