Cli Laravel 8 Laravel 9 Laravel 10 Laravel 11 Laravel 12

Artisan Command Not Found in Laravel - Fix

This error occurs when trying to run an Artisan command that doesn't exist or when PHP/artisan isn't accessible.

The Error

Error Message
Command not found / artisan: command not found

Common Causes

  1. 1 Not in Laravel project directory
  2. 2 Custom command not registered
  3. 3 PHP not in system PATH
  4. 4 Typo in command name
  5. 5 Command class has errors

Solutions

1

Ensure you're in project root

Bash
# Navigate to your Laravel project
cd /path/to/your/laravel/project

# Verify artisan exists
ls artisan

# List available commands
php artisan list
2

Register custom command

PHP
// app/Console/Kernel.php
protected $commands = [
    \App\Console\Commands\YourCustomCommand::class,
];

// Or commands are auto-discovered from app/Console/Commands
3

Create a custom command

Bash
php artisan make:command SendEmails

// In app/Console/Commands/SendEmails.php
class SendEmails extends Command
{
    protected $signature = 'mail:send {user}';
    protected $description = 'Send emails to user';
    
    public function handle()
    {
        $this->info('Sending emails...');
    }
}
4

Clear and cache commands

Bash
# Clear cached commands
php artisan clear-compiled

# If commands still not found
composer dump-autoload
php artisan package:discover

Need Help With Your Laravel Project?

I specialize in building custom Laravel applications, process automation, and SaaS development. Whether you need to eliminate repetitive tasks or build something from scratch, let's discuss your project.

Currently available for 2-3 new projects

Hafiz Riaz

About Hafiz

Full Stack Developer from Italy. I build web applications with Laravel and Vue.js, and automate business processes. Creator of ReplyGenius, StudyLab, and other SaaS products.

View Portfolio

Related Errors