我正在更新服务器代码,并且一切正常,甚至迁移和播种。
但是当我尝试login URL
时,它给了我404
错误,所以我检查了一下,然后在终端中运行了PHP artisan route: list
命令。
并得到如下错误:
PHP artisan route: list
Illuminate\Contracts\Container\BindingResolutionException : Target class [App\Http\Controllers\Api\V1\UserController] does not exist.
at /var/www/html/x/vendor/laravel/framework/src/Illuminate/Container/Container.php:805
801|
802| try {
803| $reflector = new ReflectionClass($concrete);
804| } catch (ReflectionException $e) {
> 805| throw new BindingResolutionException("Target class [$concrete] does not exist.", 0, $e);
806| }
807|
808| // If the type is not instantiable, the developer is attempting to resolve
809| // an abstract type such as an Interface or Abstract Class and there is
Exception trace:
1 Illuminate\Foundation\Console\RouteListCommand::Illuminate\Foundation\Console\{closure}()
[internal]:0
2 ReflectionException::("Class App\Http\Controllers\Api\V1\UserController does not exist")
/var/www/html/x/vendor/laravel/framework/src/Illuminate/Container/Container.php:803
Please use the argument -v to see more details.
它说找不到给定的控制器。我已经亲自检查了该文件夹,该文件夹已存在。权限是正确的,并且如果我在本地计算机上运行相同的命令,我也会在相同的代码上获得route list
。
尝试过composer dump-autoload
和composer update
仍不使用它,因为存在错误。那么这里真正的问题是什么。如何解决这个问题?
route:list
命令可用于显示应用程序所有已注册路由的列表。此命令将显示在生成的表中包含的路由的domain
,method
,URI
,name
,action
和middleware
。
如果您的文件夹中缺少任何内容,例如controller
,middleware
,则可能会发生这种错误。
确保文件夹中存在UserController
。