'Target class [blade.compiler] does not exist in laravel 8

After composer installation, When I run php artisan serve command then this errors are shown- Illuminate\Contracts\Container\BindingResolutionException

Target class [blade.compiler] does not exist in my laravel 8 project

Error in that file, vendor\laravel\framework\src\Illuminate\Container\Container.php:879

Code :

try {
    877▕             $reflector = new ReflectionClass($concrete);
    878▕         } catch (ReflectionException $e) {
  ➜ 879▕             throw new BindingResolutionException("Target class [$concrete] does not exist.", 0, $e);
    880▕         }


Solution 1:[1]

this problem can occur if you have old version of php, so try to upgrade your php version to php >= 8 following this :

-1 download php from the official website : from this link : https://www.php.net/downloads

or for windows this link : https://windows.php.net/download#php-8.1

-2 extract the zip and put the folder in your php folder

-3 update your system environment variables

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 abdelhak51