未捕获的 ReflectionException:/vendor/laravel/framework/src/Illuminate/Container/Container.php:738 中不存在类日志

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/36214236/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 13:28:08  来源:igfitidea点击:

Uncaught ReflectionException: Class log does not exist in /vendor/laravel/framework/src/Illuminate/Container/Container.php:738

phplaravel

提问by Juliatzin

I had my Laravel 5.2 working well, I was happy.

我的 Laravel 5.2 运行良好,我很高兴。

Then I executed :

然后我执行了:

 php artisan config:cache

And my day became darker

而我的日子变得更黑了

I got this message:

我收到了这条消息:

PHP Fatal error:  Uncaught ReflectionException: Class log does not exist in /home/vagrant/Code/vendor/laravel/framework/src/Illuminate/Container/Container.php:738
Stack trace:
#0 /home/vagrant/Code/vendor/laravel/framework/src/Illuminate/Container/Container.php(738): ReflectionClass->__construct('log')
#1 /home/vagrant/Code/vendor/laravel/framework/src/Illuminate/Container/Container.php(633): Illuminate\Container\Container->build('log', Array)
#2 /home/vagrant/Code/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(687): Illuminate\Container\Container->make('log', Array)
#3 /home/vagrant/Code/vendor/laravel/framework/src/Illuminate/Container/Container.php(853): Illuminate\Foundation\Application->make('log')
#4 /home/vagrant/Code/vendor/laravel/framework/src/Illuminate/Container/Container.php(808): Illuminate\Container\Container->resolveClass(Object(    ReflectionParameter))
#5 /home/vagrant/Code/vendor/laravel/framework/src/Illuminate/Container/Container.php(777): Illuminate\Container\Container->getDependencies(Arr in /home/vagrant/    Code/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 738

Fatal error: Uncaught ReflectionException: Class log does not exist in /home/vagrant/Code/vendor/laravel/framework/src/Illuminate/Container/Container.php on line     738

ReflectionException: Class log does not exist in /home/vagrant/Code/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 738

Call Stack:
    0.0007     351952   1. {main}() /home/vagrant/Code/artisan:0
    0.2149    2190096   2. Illuminate\Foundation\Console\Kernel->handle() /home/vagrant/Code/artisan:35
    0.2329    2327800   3. Illuminate\Foundation\Console\Kernel->reportException() /home/vagrant/Code/vendor/laravel/framework/src/Illuminate/Foundation/Console/    Kernel.php:117
    0.2329    2327840   4. Illuminate\Container\Container->offsetGet() /home/vagrant/Code/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:250
    0.2329    2327840   5. Illuminate\Foundation\Application->make() /home/vagrant/Code/vendor/laravel/framework/src/Illuminate/Container/Container.php:1178
    0.2329    2327896   6. Illuminate\Container\Container->make() /home/vagrant/Code/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:687
    0.2329    2327896   7. Illuminate\Container\Container->build() /home/vagrant/Code/vendor/laravel/framework/src/Illuminate/Container/Container.php:633
    0.2329    2327896   8. Illuminate\Container\Container->Illuminate\Container\{closure}() /home/vagrant/Code/vendor/laravel/framework/src/Illuminate/Container/    Container.php:735
    0.2329    2327896   9. Illuminate\Foundation\Application->make() /home/vagrant/Code/vendor/laravel/framework/src/Illuminate/Container/Container.php:230
    0.2329    2327896  10. Illuminate\Container\Container->make() /home/vagrant/Code/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:687
    0.2329    2327896  11. Illuminate\Container\Container->build() /home/vagrant/Code/vendor/laravel/framework/src/Illuminate/Container/Container.php:633
    0.2439    2371256  12. Illuminate\Container\Container->getDependencies() /home/vagrant/Code/vendor/laravel/framework/src/Illuminate/Container/Container.php:777
    0.2491    2378936  13. Illuminate\Container\Container->resolveClass() /home/vagrant/Code/vendor/laravel/framework/src/Illuminate/Container/Container.php:808
    0.2491    2378936  14. Illuminate\Foundation\Application->make() /home/vagrant/Code/vendor/laravel/framework/src/Illuminate/Container/Container.php:853
    0.2491    2378992  15. Illuminate\Container\Container->make() /home/vagrant/Code/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:687
    0.2491    2378992  16. Illuminate\Container\Container->build() /home/vagrant/Code/vendor/laravel/framework/src/Illuminate/Container/Container.php:633
    0.2491    2379104  17. ReflectionClass->__construct() /home/vagrant/Code/vendor/laravel/framework/src/Illuminate/Container/Container.php:738

I don't really know how to debug it,

我真的不知道如何调试它,

I tried to remove anything that I lastely did. Some says it is a .env file with spaces inside, but not in my case, so basically, I don't know how to debug it.

我试图删除我最近做的任何事情。有人说它是一个里面有空格的 .env 文件,但在我的情况下不是,所以基本上,我不知道如何调试它。

I tried

我试过

composer dump-autoload

I tried to delete vendor folder

我试图删除供应商文件夹

All php artisan commands fails.

所有 php artisan 命令都失败了。

It seems to happen to a lot of people but the cause always different and difficult to debug.

它似乎发生在很多人身上,但原因总是不同且难以调试。

Any help will be appreciated!

任何帮助将不胜感激!

EDIT 1: I could restore a functional version of my site deleting

编辑 1:我可以恢复我的网站删除的功能版本

bootstrap/cache/config.php

I also did a php artisan config:cache before it fails

我还做了一个 php artisan config:cache 在它失败之前

and restoring a previous version of

并恢复以前的版本

    bootstrap/cache/services.php

But I would like to use those commands, because they make a significant difference in production!

但我想使用这些命令,因为它们对生产有重大影响!

回答by Juliatzin

As noodles_ftw says, this was a config file issue. so, checking for errors in my config folder did the trick, I had an error in jwt.php

正如noodles_ftw 所说,这是一个配置文件问题。所以,检查我的配置文件夹中的错误可以解决问题,我在 jwt.php 中有错误

Hope it helps!

希望能帮助到你!

回答by Fabio Vedovelli

Always check your .env file and look for values with more than one word NOT enclosed by double quotes.

始终检查您的 .env 文件并查找包含多个未用双引号括起来的单词的值。

回答by Ankit Vishwakarma

You need to add required extension like php-mbstring,php-mysql. Install these packages and then try again

您需要添加所需的扩展名,如 php-mbstring、php-mysql。安装这些软件包,然后重试