Jonathan Pitcher
Jonathan Pitcher

Reputation: 161

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

Upvotes: 4

Views: 2850

Answers (2)

Jonathan Pitcher
Jonathan Pitcher

Reputation: 161

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.

Upvotes: 11

Victor
Victor

Reputation: 136

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

Upvotes: 0

Related Questions