【问题标题】:Laravel php artisan config:cache throws Uncaught RuntimeException: A facade root has not been set. After installing new composer packageLaravel php artisan config:cache throws Uncaught RuntimeException: A facade root has not been set。安装新的作曲家包后
【发布时间】:2018-09-22 05:20:07
【问题描述】:

我的 laravel 项目在包含 php 依赖项Shopify/shopify-php: ^0.11.0 并执行 php artisan 配置缓存后,在其开发环境中运行良好。一切都很顺利,直到我将同一个分支拉到不同的目录并为新的依赖项进行了 composer install 以反映。在执行 php artisan config:cache post install 时出现以下错误。而且我不知道从哪里开始调试它。

PHP Fatal error:  Uncaught RuntimeException: A facade root has not been set. 

in /home/apps/panel/v4.0.6/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:234
Stack trace:
#0 /home/apps/panel/v4.0.6/app/Exceptions/Handler.php(40): Illuminate\Support\Facades\Facade::__callStatic('has', Array)
#1 /home/apps/panel/v4.0.6/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(320): App\Exceptions\Handler->report(Object(Symfony\Component\Debug\Exception\FatalThrowableError))
#2 /home/apps/panel/v4.0.6/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(131): Illuminate\Foundation\Console\Kernel->reportException(Object(Symfony\Component\Debug\Exception\FatalThrowableError))
#3 /home/apps/panel/v4.0.6/artisan(35): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

如果有帮助,这是我的 gitignore

/node_modules
/public/storage
/vendor
/.idea
Homestead.json
Homestead.yaml
.env
public/.htaccess

还检查到具有较旧依赖项的分支,执行 php artisan config:cache 并返回到新分支并执行 php artisan config:cache 工作正常。

【问题讨论】:

  • 请提供 laravel 版本。
  • 我的应用的laravel版本是5.3

标签: php laravel laravel-5 composer-php laravel-artisan


【解决方案1】:

php artisan config:cache 之后尝试composer dump-autoload

【讨论】:

  • 谢谢詹姆斯。由于所有开发环境都已更新,我现在无法重复此案例。但是我还是不明白它的根本原因。
猜你喜欢
  • 2018-07-19
  • 1970-01-01
  • 2019-04-13
  • 2018-10-03
  • 1970-01-01
  • 2016-10-24
  • 2021-10-05
  • 2014-03-04
  • 2014-02-25
相关资源
最近更新 更多