问题描述
我最近有一台新PC,并开始将我的项目开发迁移到该PC.我已经安装了php
,composer
和git
并将其签出.我运行composer install
,它会拉入所有依赖项,但会引发以下错误:
I've recently got a new PC and started to migrate the development of my project over to it. I've installed php
, composer
and git
and checked it out. I run composer install
, which pulls in all of the dependencies but then throws the following error:
Writing lock file
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover
PHP Fatal error: Uncaught RuntimeException: A facade root has not been set. in /home/user/PhpstormProjects/project/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:234
Stack trace:
#0 /home/user/PhpstormProjects/project/app/Exceptions/Handler.php(61): Illuminate\Support\Facades\Facade::__callStatic('environment', Array)
#1 /home/user/PhpstormProjects/project/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(353): App\Exceptions\Handler->report(Object(Symfony\Component\Debug\Exception\FatalThrowableError))
#2 /home/user/PhpstormProjects/project/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(132): Illuminate\Foundation\Console\Kernel->reportException(Object(Symfony\Component\Debug\Exception\FatalThrowableError))
#3 /home/user/PhpstormProjects/project/artisan(33): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
# in /home/user/PhpstormProjects/project/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php on line 234
Script @php artisan package:discover handling the post-autoload-dump event returned with error code 255
我尝试删除vendor
目录和composer.lock
文件,然后重新运行composer install
,但是出现相同的错误.它在我的旧机器上运行良好.我在这里错过了一步吗?
I've tried to delete the vendor
directory and the composer.lock
file and then re-run composer install
, but I get the same error. It runs fine on my old machine. Am I missing a step here?
推荐答案
在清理日志后,发现这归因于缺少的php7.3-mysql
驱动程序.运行sudo apt-get install php7.3-mysql
解决了该问题!
After scouring the logs, it turns out that this was down to a missing php7.3-mysql
driver. Running sudo apt-get install php7.3-mysql
solved the problem!
这篇关于全新签出后运行"composer install"时,“未设置Facade根目录"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!