Laravel 6错误:目标类[加密器]不存在

时间:2019-09-11 10:35:57

标签: php laravel laravel-6

我正在运行Laravel 6和PHP 7.2,但出现此错误:

  

Illuminate \ Contracts \ Container \ BindingResolutionException抛出错误消息“目标类[encrypter]不存在。”

Stacktrace:

#14 Illuminate\Contracts\Container\BindingResolutionException in /Applications/MAMP/htdocs/kiri/kiriarabia/vendor/laravel/framework/src/Illuminate/Container/Container.php:806
#13 ReflectionException in /Applications/MAMP/htdocs/kiri/kiriarabia/vendor/laravel/framework/src/Illuminate/Container/Container.php:804
#12 ReflectionClass:__construct in /Applications/MAMP/htdocs/kiri/kiriarabia/vendor/laravel/framework/src/Illuminate/Container/Container.php:804
#11 Illuminate\Container\Container:build in /Applications/MAMP/htdocs/kiri/kiriarabia/vendor/laravel/framework/src/Illuminate/Container/Container.php:682
#10 Illuminate\Container\Container:resolve in /Applications/MAMP/htdocs/kiri/kiriarabia/vendor/laravel/framework/src/Illuminate/Container/Container.php:630
#9 Illuminate\Container\Container:make in /Applications/MAMP/htdocs/kiri/kiriarabia/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:768
#8 Illuminate\Foundation\Application:make in /Applications/MAMP/htdocs/kiri/kiriarabia/vendor/laravel/framework/src/Illuminate/Container/Container.php:946
#7 Illuminate\Container\Container:resolveClass in /Applications/MAMP/htdocs/kiri/kiriarabia/vendor/laravel/framework/src/Illuminate/Container/Container.php:874
#6 Illuminate\Container\Container:resolveDependencies in /Applications/MAMP/htdocs/kiri/kiriarabia/vendor/laravel/framework/src/Illuminate/Container/Container.php:835
#5 Illuminate\Container\Container:build in /Applications/MAMP/htdocs/kiri/kiriarabia/vendor/laravel/framework/src/Illuminate/Container/Container.php:682
#4 Illuminate\Container\Container:resolve in /Applications/MAMP/htdocs/kiri/kiriarabia/vendor/laravel/framework/src/Illuminate/Container/Container.php:630
#3 Illuminate\Container\Container:make in /Applications/MAMP/htdocs/kiri/kiriarabia/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:768
#2 Illuminate\Foundation\Application:make in /Applications/MAMP/htdocs/kiri/kiriarabia/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:215
#1 Illuminate\Foundation\Http\Kernel:terminateMiddleware in /Applications/MAMP/htdocs/kiri/kiriarabia/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:189
#0 Illuminate\Foundation\Http\Kernel:terminate in /Applications/MAMP/htdocs/kiri/kiriarabia/public/index.php:60

知道我需要解决什么吗?

3 个答案:

答案 0 :(得分:1)

如果您已将类组织到一个子文件夹中,请检查名称空间–它也应包含该子文件夹。

答案 1 :(得分:0)

将旧的加密器中间件复制到新创建的项目中间件文件夹中。

答案 2 :(得分:0)

当中间件不存在时,您可能会遇到此异常。

让我们以以下路线为例:

Route::get('/products/{productId}', 'ProductController@view')
     ->middleware('some_middleware');

如果未实现中间件some_middleware,则将获得异常目标类[some_middleware]不存在