Laravel ANY artisan commands return "Uncaught Error: Call to a member function report()" - laravel

I'm finding myself in a weird situation where any command I give to "artisan" it returns an error, even php artisan alone:
PHP Fatal error:
Uncaught Error: Call to a member function report() on null in /Users/myusername/ProjectName/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:367
Stack trace:
#0 /Users/myusername/ProjectName/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(132): Illuminate\Foundation\Console\Kernel->reportException(Object(Symfony\Component\Debug\Exception\FatalThrowableError))
#1 /Users/myusername/ProjectName/artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#2 {main} thrown in /Users/myusername/ProjectName/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php on line 367
I've not touched the vendor/laravel folder and tried updating to latest Laravel version so I suppose this error is not something I'm creating with wrong code but something other I don't really get.
It's saying the error is here:
//vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php
protected function reportException(Exception $e)
{
$this->app[ExceptionHandler::class]->report($e);
}
I've tried updating Laravel, but with on luck. So I even upgraded and got the same result. What could be causing it?

Ok I found out the error is thrown when you set a __construct() inside app/Console/Kernel.php

Related

toastr package Fatal error: Uncaught RuntimeException: A facade root has not been set

I'm trying to use Toastr package in my application to have alerts displayed to the user. I followed the tutorial here but now I can't have access to my app; I'm having this error :
Fatal error: Uncaught RuntimeException: A facade root has not been set. in C:\xampp\htdocs\MonProjet\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php:234 Stack trace: #0 C:\xampp\htdocs\MonProjet\vendor\laravel\framework\src\Illuminate\Foundation\Exceptions\Handler.php(397): Illuminate\Support\Facades\Facade::__callStatic('replaceNamespac...', Array) #1 C:\xampp\htdocs\MonProjet\vendor\laravel\framework\src\Illuminate\Foundation\Exceptions\Handler.php(374): Illuminate\Foundation\Exceptions\Handler->registerErrorViewPaths() #2 C:\xampp\htdocs\MonProjet\vendor\laravel\framework\src\Illuminate\Foundation\Exceptions\Handler.php(289): Illuminate\Foundation\Exceptions\Handler->renderHttpException(Object(Symfony\Component\HttpKernel\Exception\HttpException)) #3 C:\xampp\htdocs\MonProjet\vendor\laravel\framework\src\Illuminate\Foundation\Exceptions\Handler.php(188): Illuminate\Foundation\Exceptions\Handler->prepareResponse(Object(Illuminate\Http\Request), Object(Symfony\Component\HttpKernel\Exception\HttpExcepti in C:\xampp\htdocs\MonProjet\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php on line 234
Any thoughts on this issue? I've followed the steps and I'm getting this error. What is wrong there.. ?
Your question is not clear. please details,
and you can add your blade # before render. example:-
#toastr()->render();

Laravel: PHP artisan Command Stopped Working

php artisan --version
[Symfony\Component\Debug\Exception\FatalThrowableError]
Fatal error: Call to a member function getArgument() on null
Log files...
[2018-02-01 19:26:51] local.ERROR: Symfony\Component\Debug\Exception\FatalThrowableError: Fatal error: Call to a member function getArgument() on null in /Library/WebServer/vhosts/mysitename/vendor/laravel/framework/src/Illuminate/Console/Command.php:216
Stack trace:
#0 /Library/WebServer/vhosts/mysitename/app/Console/Commands/ReportMonthlyMembershipAircraftBreakdown.php(69): Illuminate\Console\Command->argument('email')
#1 [internal function]: App\Console\Commands\ReportMonthlyMembershipAircraftBreakdown->__construct()
#2 /Library/WebServer/vhosts/mysitename/vendor/laravel/framework/src/Illuminate/Container/Container.php(783): ReflectionClass->newInstanceArgs(Array)
#3 /Library/WebServer/vhosts/mysitename/vendor/laravel/framework/src/Illuminate/Container/Container.php(633): Illuminate\Container\Container->build('App\\Console\\Com...', Array)
#4 /Library/WebServer/vhosts/mysitename/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(697): Illuminate\Container\Container->make('App\\Console\\Com...', Array)
#5 /Library/WebServer/vhosts/mysitename/vendor/laravel/framework/src/Illuminate/Console/Application.php(115): Illuminate\Foundation\Application->make('App\\Console\\Com...')
#6 /Library/WebServer/vhosts/mysitename/vendor/laravel/framework/src/Illuminate/Console/Application.php(129): Illuminate\Console\Application->resolve('App\\Console\\Com...')
#7 /Library/WebServer/vhosts/mysitename/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(237): Illuminate\Console\Application->resolveCommands(Array)
#8 /Library/WebServer/vhosts/mysitename/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(107): Illuminate\Foundation\Console\Kernel->getArtisan()
#9 /Library/WebServer/vhosts/mysitename/artisan(35): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 {main}
I have deleted my entire vendor folder and tried to reinstate it, and it always gets to here and blows up with the same error.
Generating autoload files
> php artisan clear-compiled
[Symfony\Component\Debug\Exception\FatalThrowableError]
Fatal error: Call to a member function getArgument() on null
Here is my version pulled from the file, since I can't run an artisan --version to get it for you.
/**
* The Laravel framework version.
*
* #var string
*/
const VERSION = '5.2.32';
Just looking for any help you can give me. This has happened on both my local copy and the site copy
The problem came from having the command
$this->argument in the contructor and not in the handle method.
I just never expected that a console file would stop php artisan --version from stopping to work because of a command file that was not going to be run yet.
Thanks btl for getting me on the right direction.
You have an error in your code somewhere most likely which is giving you this error. Do a global search on getArgument() and see where it can be coming from.
[internal function]: App\Console\Commands\ReportMonthlyMembershipAircraftBreakdown

Composer Update with Laravel 5.4 & PHP 7 "Class Name must be a valid object or a string"

So there are a few threads on this but none with exactly the same issue. Basically I upgraded to php 5.4 from 5.1 and php 7 from 5.6 and I am now getting this error message.
PHP Fatal error: Uncaught Error: Class name must be a valid object or a string in /var/www/dev1/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php:96
The reason this seems weird to me is the error is in the actual laravel files not in my app / something I have edited. This error happens when I run composer update or whenever I try and visit any of my webpages. Below is a full dump from composer update, any ideas?
[root#dev1 dev1]# composer update
> php artisan clear-compiled
PHP Fatal error: Uncaught Error: Class name must be a valid object or a string in /var/www/dev1/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php:96
Stack trace:
#0 [internal function]: Illuminate\Foundation\Exceptions\Handler->Illuminate\Foundation\Exceptions\{closure}(0, 'Symfony\\Compone...')
#1 /var/www/dev1/bootstrap/cache/compiled.php(6207): call_user_func(Object(Closure), 0, 'Symfony\\Compone...')
#2 /var/www/dev1/bootstrap/cache/compiled.php(12223): Illuminate\Support\Arr::first(Array, Object(Closure), NULL)
#3 /var/www/dev1/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(97): Illuminate\Support\Collection->first(Object(Closure))
#4 /var/www/dev1/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(61): Illuminate\Foundation\Exceptions\Handler->shouldntReport(Object(ReflectionException))
#5 /var/www/dev1/app/Exceptions/Handler.php(33): Illuminate\Foundation\Exceptions\Handler->report(Object(ReflectionException))
#6 /var/www/dev1/vendor/laravel/fram in /var/www/dev1/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php on line 96
Script php artisan clear-compiled handling the pre-update-cmd event returned with error code 255
I've got a similar error when upgrading to Laravel 5.4. The problem is that Laravel is still loading bootstrap/cache/compiled.php (even though it says it's not used by the framework anymore). Removing the file will solve your issue.
From the docs:
If it exists, you may delete the bootstrap/cache/compiled.php file. It is no longer used by the framework.
php artisan cache:clear
php artisan clear-compiled
sudo composer dump-autoload

Bugsnag error when running artisan command

I got this error when trying to run my php artisan migrate on my production server...
PHP Fatal error: Uncaught exception 'Exception' with message 'Bugsnag Error: Invalid API key' in /var/app/current/vendor/bugsnag/bugsnag/src/Bugsnag/Client.php:19
Stack trace:
#0 /var/app/current/vendor/bugsnag/bugsnag-laravel/src/Bugsnag/BugsnagLaravel/BugsnagLaravelServiceProvider.php(61): Bugsnag_Client->__construct(NULL)
#1 /var/app/current/vendor/laravel/framework/src/Illuminate/Container/Container.php(738): Bugsnag\BugsnagLaravel\BugsnagLaravelServiceProvider->Bugsnag\BugsnagLaravel\{closure}(Object(Illuminate\Foundation\Application), Array)
#2 /var/app/current/vendor/laravel/framework/src/Illuminate/Container/Container.php(631): Illuminate\Container\Container->build(Object(Closure), Array)
#3 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(674): Illuminate\Container\Container->make('bugsnag', Array)
#4 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(62): Illuminate\Foundation\Application->make('bugsnag', Array)
#5 /var/app/current/vendor/bugsnag/bugsna in /var/app/current/vendor/bugsnag/bugsnag/src/Bugsnag/Client.php on line 19
PHP Fatal error: Uncaught exception 'Exception' with message 'Bugsnag Error: Invalid API key' in /var/app/current/vendor/bugsnag/bugsnag/src/Bugsnag/Client.php:19
Stack trace:
#0 /var/app/current/vendor/bugsnag/bugsnag-laravel/src/Bugsnag/BugsnagLaravel/BugsnagLaravelServiceProvider.php(61): Bugsnag_Client->__construct(NULL)
#1 /var/app/current/vendor/laravel/framework/src/Illuminate/Container/Container.php(738): Bugsnag\BugsnagLaravel\BugsnagLaravelServiceProvider->Bugsnag\BugsnagLaravel\{closure}(Object(Illuminate\Foundation\Application), Array)
#2 /var/app/current/vendor/laravel/framework/src/Illuminate/Container/Container.php(631): Illuminate\Container\Container->build(Object(Closure), Array)
#3 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(674): Illuminate\Container\Container->make('bugsnag', Array)
#4 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(62): Illuminate\Foundation\Application->make('bugsnag', Array)
#5 /var/app/current/vendor/bugsnag/bugsna in /var/app/current/vendor/bugsnag/bugsnag/src/Bugsnag/Client.php on line 19
I ran env on the command line and I have an env variable called BUGSNAG_API_KEY and the value of it exactly matches the key at bugsnag.com for this project.
Furthermore, I have this line in my project at ./config/bugsnag.php
'api_key' => env('BUGSNAG_API_KEY'),
Weirdly, I eventually tried the same command again (php artisan migrate) and it worked! But it's left me very unsettled as it's a production server. So I'd like to understand the problem.
Errors seem to be logging in Bugsnag as well by the way.
Try to regenerate the configuration cache with php artisan config:cache. It will use the current data from the .env file to generate a new configuration cache. This worked for me.
In case this helps anyone...
The Bugsnag Git Repo mentions this issue:
(Uncaught exception 'ReflectionException' with message 'Class bugsnag.logger does not exist'
Github user GrahamCampbell suggested that what is actually happening is that another error exists, but it's "...trying to log to bugsnag which is causing this error, which is hiding the real error". I confirmed this was my issue by doing what user russianryebread suggested, which was to manually copy the bugsnag.php config file over to the Laravel /config directory. Once I did that now my real error shows:
[Symfony\Component\Debug\Exception\FatalThrowableError] Parse error: syntax error, unexpected '{'
Now to troubleshoot this issue :)
Hope this helps!

Blank white page when finished uploading files to server laravel5

I have finished uploading files to server inside demo folder, but when i visited i got blank white page. when i visited somedomain.com/demo i got blank white page. Can anyone help me please. My folder directory start with demo. Inside demofolder i have app,bootstrap,config etc folders.
when i view storage/log file i got
[2015-09-20 06:38:00] local.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Call to undefined method Illuminate\Foundation\Application::getCachedCompilePath()' in C:\xampp\htdocs\sidinsu\project\vendor\laravel\framework\src\Illuminate\Foundation\Console\ClearCompiledCommand.php:28
Stack trace:
#0 {main}
[2015-09-20 06:52:16] local.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Call to undefined method Illuminate\Foundation\Application::getCachedCompilePath()' in C:\xampp\htdocs\sidinsu\project\vendor\laravel\framework\src\Illuminate\Foundation\Console\ClearCompiledCommand.php:28
Stack trace:
#0 {main}
[2015-09-20 06:53:23] local.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Call to undefined method Illuminate\Foundation\Application::getCachedCompilePath()' in C:\xampp\htdocs\sidinsu\project\vendor\laravel\framework\src\Illuminate\Foundation\Console\ClearCompiledCommand.php:28
Stack trace:
#0 {main}
[2015-09-20 06:58:28] local.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Call to undefined method Illuminate\Foundation\Application::getCachedCompilePath()' in C:\xampp\htdocs\sidinsu\project\vendor\laravel\framework\src\Illuminate\Foundation\Console\ClearCompiledCommand.php:28
Stack trace:
#0 {main}
The blank page suggests a 500 error and your logs back this up.
Looking at your logs it is an issue with the vendor/compiled.php file.
Just delete this file, run composer update, and then php artisan optimize after the update to rebuild compiled.php.
On a side note, the URL to view this should be somedomain.com/demo/public as this is where the index.php file is located - unless you have already dealt to this.
When you move Laravel 5 to a production server please do the following:
Change permissions of storage and bootstrap folders to 0755 or 0777 chmod -R 0777 storage/
composer install
composer update
artisan cache:clear
This will resolve your dependencies and make laravel functional.
When you get packages conflicts after doing the above steps remove the packages from app/config/app.php and delete their folders from vendor and run composer update.
Also make sure you will meet Laravel 5 minimum requirements. PHP 5.5.9 is required.

Resources