Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

There are no commands defined in the "passport" namespace. When installing API Authentication In laravel

Tags:

laravel-5

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.
like image 322
Nikhil Solanki Avatar asked Apr 04 '17 05:04

Nikhil Solanki


4 Answers

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

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 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!

like image 98
Connor Leech Avatar answered Sep 18 '22 07:09

Connor Leech


Just follow these steps:

  1. composer require laravel/passport. Once the installation finishes, add the following provider in the config/app.php file: Laravel\Passport\PassportServiceProvider::class,
  2. php artisan migrate
  3. php artisan passport:install
like image 29
Patrick_udoh Avatar answered Sep 18 '22 07:09

Patrick_udoh


I was searching for a solution for this and I found simple one that worked for me:

Add these lines to $commands array in app/Console/Kernel.php

    \Laravel\Passport\Console\InstallCommand::class,
    \Laravel\Passport\Console\KeysCommand::class,
    \Laravel\Passport\Console\ClientCommand::class,
like image 45
Abdalla Hisham Avatar answered Sep 18 '22 07:09

Abdalla Hisham


Try running composer require laravel/passport "~9.0" before running php artisan passport:install

like image 24
Regina Garcia Avatar answered Sep 19 '22 07:09

Regina Garcia