Hi there,
In my latest full stack Roots project, I’m using php 8.1 on my droplet, locally I was still on php 8.0 but I set the platform php option to 8.1 in my composer.json. I did get a warning, but my Sage theme was running fine.
However last week I switched to 8.1 with brew-php-switcher and suddenly I’m starting to get this error in my theme (admin & front-end):
Fatal error: Declaration of Illuminate\Foundation\Application::publicPath() must be compatible with Illuminate\Contracts\Foundation\Application::publicPath($path = '') in /srv/www/example.com/current/vendor/roots/acorn/src/Illuminate/Foundation/Application.php on line 453
This happens when Acorn 3.2 is installed in the bedrock folder. I tried:
- Removing
app/cache
folder - Running
rm -rf ./vendor && rm composer.lock && composer install
- Running
wp @development acorn optimize:clear
&wp @development acorn config:clear
Nothing works?
When I remove "roots/acorn": "^3.2"
and run composer require roots/acorn
, it installs the dev-laravel-10
acorn branch, but then I get errors when running any Acorn WP-CLI command:
In ProviderRepository.php line 109:
Undefined array key "providers"
and even more errors in browser:
Uncaught ReflectionException: Class "view" does not exist in /srv/www/example.com/current/vendor/illuminate/container/Container.php:912 Stack trace: #0 /srv/www/example.com/current/vendor/illuminate/container/Container.php(912): ReflectionClass->__construct('view') #1 /srv/www/example.com/current/vendor/illuminate/container/Container.php(795): Illuminate\Container\Container->build('view') #2 /srv/www/example.com/current/vendor/roots/acorn/src/Illuminate/Foundation/Application.php(933): Illuminate\Container\Container->resolve('view', Array, true) #3 /srv/www/example.com/current/vendor/illuminate/container/Container.php(731): Illuminate\Foundation\Application->resolve('view', Array) #4 /srv/www/example.com/current/vendor/roots/acorn/src/Illuminate/Foundation/Application.php(918): Illuminate\Container\Container->make('view', Array) #5 /srv/www/example.com/current/vendor/illuminate/container/Container.php(1454): Illuminate\Foundation\Application->make('view') #6 /srv/www/example.com/current/vendor/illuminate/support/Facades/Facade.php(236): Illuminate\Container\Container->offsetGet('view') #7 /srv/www/example.com/current/vendor/illuminate/support/Facades/Facade.php(207): Illuminate\Support\Facades\Facade::resolveFacadeInstance('view') #8 /srv/www/example.com/current/vendor/illuminate/support/Facades/Facade.php(347): Illuminate\Support\Facades\Facade::getFacadeRoot() #9 /srv/www/example.com/current/vendor/roots/acorn/src/Illuminate/Foundation/Exceptions/RegisterErrorViewPaths.php(18): Illuminate\Support\Facades\Facade::__callStatic('replaceNamespac...', Array) #10 /srv/www/example.com/current/vendor/roots/acorn/src/Illuminate/Foundation/Exceptions/Handler.php(661): Illuminate\Foundation\Exceptions\RegisterErrorViewPaths->__invoke() #11 /srv/www/example.com/current/vendor/roots/acorn/src/Illuminate/Foundation/Exceptions/Handler.php(642): Illuminate\Foundation\Exceptions\Handler->registerErrorViewPaths() #12 /srv/www/example.com/current/vendor/roots/acorn/src/Illuminate/Foundation/Exceptions/Handler.php(573): Illuminate\Foundation\Exceptions\Handler->renderHttpException(Object(Symfony\Component\HttpKernel\Exception\HttpException)) #13 /srv/www/example.com/current/vendor/roots/acorn/src/Roots/Acorn/Exceptions/Handler.php(28): Illuminate\Foundation\Exceptions\Handler->prepareResponse(Object(Illuminate\Http\Request), Object(Symfony\Component\HttpKernel\Exception\HttpException)) #14 /srv/www/example.com/current/vendor/roots/acorn/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(217): Roots\Acorn\Exceptions\Handler->render(Object(Illuminate\Http\Request), Object(ErrorException)) #15 /srv/www/example.com/current/vendor/roots/acorn/src/Roots/Acorn/Bootstrap/HandleExceptions.php(92): Illuminate\Foundation\Bootstrap\HandleExceptions->renderHttpResponse(Object(ErrorException)) #16 /srv/www/example.com/current/vendor/roots/acorn/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(194): Roots\Acorn\Bootstrap\HandleExceptions->renderHttpResponse(Object(ErrorException)) #17 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleException(Object(ErrorException)) #18 {main} Next Illuminate\Contracts\Container\BindingResolutionException: Target class [view] does not exist. in /srv/www/example.com/current/vendor/illuminate/container/Container.php:914 Stack trace: #0 /srv/www/example.com/current/vendor/illuminate/container/Container.php(795): Illuminate\Container\Container->build('view') #1 /srv/www/example.com/current/vendor/roots/acorn/src/Illuminate/Foundation/Application.php(933): Illuminate\Container\Container->resolve('view', Array, true) #2 /srv/www/example.com/current/vendor/illuminate/container/Container.php(731): Illuminate\Foundation\Application->resolve('view', Array) #3 /srv/www/example.com/current/vendor/roots/acorn/src/Illuminate/Foundation/Application.php(918): Illuminate\Container\Container->make('view', Array) #4 /srv/www/example.com/current/vendor/illuminate/container/Container.php(1454): Illuminate\Foundation\Application->make('view') #5 /srv/www/example.com/current/vendor/illuminate/support/Facades/Facade.php(236): Illuminate\Container\Container->offsetGet('view') #6 /srv/www/example.com/current/vendor/illuminate/support/Facades/Facade.php(207): Illuminate\Support\Facades\Facade::resolveFacadeInstance('view') #7 /srv/www/example.com/current/vendor/illuminate/support/Facades/Facade.php(347): Illuminate\Support\Facades\Facade::getFacadeRoot() #8 /srv/www/example.com/current/vendor/roots/acorn/src/Illuminate/Foundation/Exceptions/RegisterErrorViewPaths.php(18): Illuminate\Support\Facades\Facade::__callStatic('replaceNamespac...', Array) #9 /srv/www/example.com/current/vendor/roots/acorn/src/Illuminate/Foundation/Exceptions/Handler.php(661): Illuminate\Foundation\Exceptions\RegisterErrorViewPaths->__invoke() #10 /srv/www/example.com/current/vendor/roots/acorn/src/Illuminate/Foundation/Exceptions/Handler.php(642): Illuminate\Foundation\Exceptions\Handler->registerErrorViewPaths() #11 /srv/www/example.com/current/vendor/roots/acorn/src/Illuminate/Foundation/Exceptions/Handler.php(573): Illuminate\Foundation\Exceptions\Handler->renderHttpException(Object(Symfony\Component\HttpKernel\Exception\HttpException)) #12 /srv/www/example.com/current/vendor/roots/acorn/src/Roots/Acorn/Exceptions/Handler.php(28): Illuminate\Foundation\Exceptions\Handler->prepareResponse(Object(Illuminate\Http\Request), Object(Symfony\Component\HttpKernel\Exception\HttpException)) #13 /srv/www/example.com/current/vendor/roots/acorn/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(217): Roots\Acorn\Exceptions\Handler->render(Object(Illuminate\Http\Request), Object(ErrorException)) #14 /srv/www/example.com/current/vendor/roots/acorn/src/Roots/Acorn/Bootstrap/HandleExceptions.php(92): Illuminate\Foundation\Bootstrap\HandleExceptions->renderHttpResponse(Object(ErrorException)) #15 /srv/www/example.com/current/vendor/roots/acorn/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(194): Roots\Acorn\Bootstrap\HandleExceptions->renderHttpResponse(Object(ErrorException)) #16 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleException(Object(ErrorException)) #17 {main} thrown in /srv/www/example.com/current/vendor/illuminate/container/Container.php on line 914
What am I missing here? Acorn is compatible with php 8.1 right? Any help is appreciated.
Thanks!