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

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

问题描述

我跑步时遇到错误 php artisan护照:安装

I am getting below error when i run php artisan passport:install

[Symfony\Component\Console\Exception\CommandNotFoundException]
There are no commands defined in the "passport" namespace.

推荐答案

要安装laravel护照,请确保将此行添加到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):

Laravel\Passport\PassportServiceProvider::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!

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

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