After in my Laravel 9 project I run composer update
I faced this error message:
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 0 installs, 1 update, 1 removal
- Downloading fruitcake/laravel-cors (v3.0.0)
- Removing asm89/stack-cors (v2.1.1)
- Upgrading fruitcake/laravel-cors (v2.2.0 => v3.0.0): Extracting archive
77 package suggestions were added by new dependencies, use `composer suggest` to see details.
Generating optimized autoload files
> IlluminateFoundationComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
In Finder.php line 588:
syntax error, unexpected token ")"
Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1
It seems update was finished, but something went wrong and now in the console I get syntax error, unexpected token ")"
error on Finder.php:588
.
I checked this file and it’s looks correct.
When I open my project in browser I get this error:
Fatal error: Uncaught RuntimeException: A facade root has not been set. in /var/www/html/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:334
Stack trace:
#0 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/RegisterErrorViewPaths.php(18): IlluminateSupportFacadesFacade::__callStatic('replaceNamespac...', Array)
#1 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(626): IlluminateFoundationExceptionsRegisterErrorViewPaths->__invoke()
#2 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(607): IlluminateFoundationExceptionsHandler->registerErrorViewPaths()
#3 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(538): IlluminateFoundationExceptionsHandler->renderHttpException(Object(SymfonyComponentHttpKernelExceptionHttpException))
#4 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(444): IlluminateFoundationExceptionsHandler->prepareResponse(Object(IlluminateHttpRequest), Object(SymfonyComponentHttpKernelExceptionHttpException))
#5 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(364): IlluminateFoundationExceptionsHandler->renderExceptionResponse(Object(IlluminateHttpRequest), Object(ParseError))
#6 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(427): IlluminateFoundationExceptionsHandler->render(Object(IlluminateHttpRequest), Object(ParseError))
#7 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(115): IlluminateFoundationHttpKernel->renderException(Object(IlluminateHttpRequest), Object(ParseError))
#8 /var/www/html/public/index.php(52): IlluminateFoundationHttpKernel->handle(Object(IlluminateHttpRequest))
#9 {main}
thrown in /var/www/html/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php on line 334
I cleared all the caches in bootstrap/cahce/
and in storage/framework/cache/data/
, storage/framework/sessions/
, storage/framework/views/
folders too.
I use PHP version 8.0.16.
Composer version 2.0.12 2021-04-01 10:14:59.
Any idea how can I fix this?
4
Answers
I found a soution:
docker pull composer
to upgrade latest version of composer (from 2.0 to 2.2)composer update
in Docker containerI did :
and i have a similar issue now :
So i think it’s the version of symfony/finder that is not compatible with php 8.0, try to downgrade any symfony related package to 6.0.x, because i don’t think you require symfony/finder directly, but some other package like symfony/http-client
I think you perhaps installed dependencies using php 8.1 at some point and you got wrong packages versions, or perhaps you have laravel 10 installed and not laravel 9 ?
To continue using php 8.0 add these entries to your composer.json
Worked for me with php 8.0 and Laravel 9.
Upgrading your PHP version to
PHP 8.1
should solve the problem. And just make sure to runcomposer install
orcomposer update
again