Reputation: 1190
I've been stuggeling with this problem now for days: Installting Laravel passport. I did all accoring to the tutorial. What I did
composer require laravel/passport
Added Laravel\Passport\PassportServiceProvider::class,
to the config/app.php
run php artisan migrate
and then php artisan passport:install
The crasy thing is this works on my local machine. But when I upload this to my webspace via ftp and run php artisan passport:install
it gets me this Error:
Uncaught exception - 'There are no commands defined in the "passport" namespace.'
Full error (see on pastbin)
PHP Fatal error: Uncaught exception 'Symfony\Component\Console\Exception\CommandNotFoundException' with message 'There are no commands defined in the "passport" namespace.' in /mnt/web102/d0/25/58432925/htdocs/www/vendor/symfony/console/Application.php:533
Stack trace:
#0 /mnt/web102/d0/25/58432925/htdocs/www/vendor/symfony/console/Application.php(565): Symfony\Component\Console\Application->findNamespace('passport')
#1 /mnt/web102/d0/25/58432925/htdocs/www/vendor/symfony/console/Application.php(204): Symfony\Component\Console\Application->find('passport:instal...')
#2 /mnt/web102/d0/25/58432925/htdocs/www/vendor/symfony/console/Application.php(130): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 /mnt/web102/d0/25/58432925/htdocs/www/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(122): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Comp in /mnt/web102/d0/25/58432925/htdocs/www/vendor/symfony/console/Application.php on line 533
PHP Fatal error: Uncaught exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Uncaught exception 'Symfony\Component\Console\Exception\CommandNotFoundException' with message 'There are no commands defined in the "passport" namespace.' in /mnt/web102/d0/25/58432925/htdocs/www/vendor/symfony/console/Application.php:533
Stack trace:
#0 /mnt/web102/d0/25/58432925/htdocs/www/vendor/symfony/console/Application.php(565): Symfony\Component\Console\Application->findNamespace('passport')
#1 /mnt/web102/d0/25/58432925/htdocs/www/vendor/symfony/console/Application.php(204): Symfony\Component\Console\Application->find('passport:instal...')
#2 /mnt/web102/d0/25/58432925/htdocs/www/vendor/symfony/console/Application.php(130): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 /mnt/web102/d0/25/58432925/htdocs/www/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(122): Symfony\Component\Consol in /mnt/web102/d0/25/58432925/htdocs/www/vendor/symfony/console/Application.php on line 533
Status: 500 Internal Server Error
X-Powered-By: PHP/5.6.30
Content-type: text/html
What I did.
php composer.phar clearcace
php composer.phar update
php artisan cache:clear
php artisan config:cache
php artisan migrate
php artisan passport:install
And then the error happens...
If did php composer.phar require laravel/passport
and can see via ftp that in the /vendor/laravel/ the passport folder is there!
Upvotes: 2
Views: 7946
Reputation: 794
I had the same problem and i it worked after i did this
Composer update php artisan config:cache php artisan migrate php artisan passport:install
Upvotes: 0
Reputation: 76
If you run on shared hosting try
export APP_RUNNING_IN_CONSOLE=true
After that you can run php artisan passport:install
Laravel's runningInConsole method check if that environment is set or the output php_sapi_name()
is cli or phpdbg. At a shared host it can be cgi-fcgi
Upvotes: 4
Reputation: 1190
What I have done to do solve the problem!
Inside \vendor\laravel\passport\src\PassportServiceProvider.php
if deleted the
if ($this->app->runningInConsole()) {
in line 37. After uploading this to my webspace if could have full use of laravel:passport
Thanks for all the other help!
Upvotes: 4
Reputation: 97
Have you tried using:
php artisan config:clear
Instead of config:cache. It seems to have worked for me, which makes sense as you register the passport class in config/app.
Clearing all the cache also fixed me not being able to use "artisan migrate", where it previously said "nothing to migrate". The migrations don't seem to appear in database/migrations.
Upvotes: 0
Reputation: 152
I guess you have problem that passport not installed, if you are working via FTP do these steps:
Hope this will work.
Upvotes: 0