“passport”命名空间中没有定义命令。在laravel中安装API身份验证时

时间:2017-04-04 05:50:09

标签: laravel-5

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

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

5 个答案:

答案 0 :(得分:19)

要安装laravel passport,请确保将此行添加到providers数组(包服务提供商部分)中的 config / app.php

Laravel\Passport\PassportServiceProvider::class,

然后安装软件包并迁移数据库

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

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

php artisan config:clear  
php artisan config:cache 

Config clear删除配置缓存文件。配置缓存使用当前设置创建新的配置缓存文件。配置缓存可以加快应用程序的加载速度!

答案 1 :(得分:6)

我得到了解决方案。运行以下两个命令后,每件事情都可以正常工作。

run php artisan cache:clear
run php artisan config:cach

答案 2 :(得分:1)

在运行 package main import ( "fmt" mqtt "github.com/eclipse/paho.mqtt.golang" "time" ) func main() { timeout, _ := time.ParseDuration("10s") opts := mqtt.NewClientOptions() opts.AddBroker("tcp://this.does.not.resolve.example.coooom:1883") opts.SetClientID("monitor") opts.SetOrderMatters(false) opts.SetAutoReconnect(true).SetMaxReconnectInterval(10 * time.Second) opts.SetConnectRetry(true) opts.SetConnectTimeout(timeout) client := mqtt.NewClient(opts) token := client.Connect() go func(token mqtt.Token) { for { done := token.WaitTimeout(1 * time.Minute) if done { if token.Error() != nil { fmt.Println("Connection permanently failed (most probably due to call to Disconnect)", token.Error()) } else { fmt.Println("Connection established") } return // We are done! } fmt.Println("Async MQTT Connection still trying (there could be an issue!)") // Can call `client.Disconnect()` to cancel connection if you want to cancel the connection attempts } }(token) // Do some stuff - you can publish messages and the library will send them when the connection comes up } 之前尝试运行 composer require laravel/passport "~9.0"

答案 3 :(得分:0)

我正在寻找解决方案,发现了一个简单的解决方案:

将此行添加到app / Console / Kernel.php中的$ commands数组

\Laravel\Passport\Console\InstallCommand::class,
\Laravel\Passport\Console\KeysCommand::class,
\Laravel\Passport\Console\ClientCommand::class,

答案 4 :(得分:0)

sudo gedit /etc/java-8-openjdk/accessibility.properties