“护照"中没有定义命令.命名空间.在laravel中安装API认证时 [英] There are no commands defined in the "passport" namespace. When installing API Authentication In laravel

查看:25
本文介绍了“护照"中没有定义命令.命名空间.在laravel中安装API认证时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我运行时遇到以下错误php 工匠护照:安装

[SymfonyComponentConsoleExceptionCommandNotFoundException]
There are no commands defined in the "passport" namespace.

推荐答案

对于安装 Laravel Passport,请确保将此行添加到 providers 数组中的 config/app.php(包服务提供者部分):

For installing laravel passport make sure you add this line to config/app.php in the providers array (package service providers section):

LaravelPassportPassportServiceProvider::class,

然后安装包并迁移数据库

Then install the package and migrate the database

composer require laravel/passport
php artisan migrate 
php artisan passport:install

当命令不起作用时,清除缓存通常是有用的第一步,尤其是当您更新 .env 文件的 config 文件夹中的任何内容时.

Clearing out the cache is generally helpful first step when commands are not working, especially when you update anything in the config folder on .env files.

php artisan config:clear  
php artisan config:cache 

Config clear 删除配置缓存文件.配置缓存使用当前设置创建一个新的配置缓存文件.配置缓存可加快应用加载速度!

Config clear removes the configuration cache file. Config cache creates a new configuration cache file with the current settings. Config cache enables faster load times for your apps!

这篇关于“护照"中没有定义命令.命名空间.在laravel中安装API认证时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆