Did the command override your current migrations?
Where is run coming from?
I get ERROR Command "run" is not defined.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Everything was running fine with my Laravel 6 app on Laragon. I created a migration to add a column to my users table. All went well, Artisan created the migration, which I edited as one does - so far so good.
Despite having done this hundreds of times I then had a brain fart, and instead or running php artisan migrate in my CLI, I typed php artisan run:migration
Now my app is broken and I get the error In Application.php line 679: Class 'Laravel\Dusk\DuskServiceProvider' not found when I go to do anything, either in the CLI or running my app.
How would my bad CLI command cause this and how do I best repair it?
Did the command override your current migrations?
Where is run coming from?
I get ERROR Command "run" is not defined.
Not 100% sure I understand the question. I don't see any differences. My migrations are still there in the database/migrations folder, as is the one I wanted to migrate when I broke Laravel.
After I realized that command was a boo-boo, I tried php artisan migrate which is when I got that error and then found it everywhere else. That last migration has not yet been implemented as I can't get any artisan function to work.
Does that answer your question?
Unless I am missing something, there is no php artisan run:migration command.
So make sure your other migrate command didn't overwrite something needed.
Do you have a backup of all of this?
Can you share your code?
Also, is there a reason you haven't updated your app to the current version?
@hondaman900 Does any change in your code files by mistake, check git log if its exists and also check the migration table for latest migration done or not. and also verfiy your tables for latest changes effect or not. For Laravel\Dusk\DuskServiceProvider not found you can check compatibility package version with laravel version and update it if required. Let me know if it works or not.
To answer all the questions...
No, there's no artisan run:migrate command, that was just my dumb mistake. But thereafter noting will run because of this "can't find dusk" error. I never got to run the migration as everything including artisan broke.
I'm working on a clone of an existing L6 site that uses an old version of stripe-php. I'm in the process of rewriting the ecommerce code to use Stripe Checkout in advance of an upgrade, which is where this broke. I didn't get to my first commit so my "backup" would be to re-clone the original site. I'm not too far from that, so I could go back to square one and keep the new .ENV to quickly get the local connections back, but I was hoping someone would recognize the issue and say "oh yeah, you must have changed xxx. Change it back and all will be well again." I also hate going back via retore when I don't know what the issue is - it remains a nagging mystery.
It looks like the offending line in index.php is
$response = $kernel->handle(
$request = Illuminate\Http\Request::capture()
);
which reports the following error and cascades from there:
Class 'Laravel\Dusk\DuskServiceProvider' not found
(1/1) Error
Class 'Laravel\Dusk\DuskServiceProvider' not found
in Application.php line 679
at Application->resolveProvider('Laravel\Dusk\DuskServiceProvider')
in Application.php line 613
at Application->register('Laravel\Dusk\DuskServiceProvider')
in ProviderRepository.php line 75
at ProviderRepository->load(array('Illuminate\Auth\AuthServiceProvider', 'Illuminate\Broadcasting\BroadcastServiceProvider', 'Illuminate\Bus\BusServiceProvider', 'Illuminate\Cache\CacheServiceProvider', 'Illuminate\Foundation\Providers\ConsoleSupportServiceProvider', 'Illuminate\Cookie\CookieServiceProvider', 'Illuminate\Database\DatabaseServiceProvider', 'Illuminate\Encryption\EncryptionServiceProvider', 'Illuminate\Filesystem\FilesystemServiceProvider', 'Illuminate\Foundation\Providers\FoundationServiceProvider', 'Illuminate\Hashing\HashServiceProvider', 'Illuminate\Mail\MailServiceProvider', 'Illuminate\Notifications\NotificationServiceProvider', 'Illuminate\Pagination\PaginationServiceProvider', 'Illuminate\Pipeline\PipelineServiceProvider', 'Illuminate\Queue\QueueServiceProvider', 'Illuminate\Redis\RedisServiceProvider', 'Illuminate\Auth\Passwords\PasswordResetServiceProvider', 'Illuminate\Session\SessionServiceProvider', 'Illuminate\Translation\TranslationServiceProvider', 'Illuminate\Validation\ValidationServiceProvider', 'Illuminate\View\ViewServiceProvider', 'Aloha\Twilio\Support\Laravel\ServiceProvider', 'Barryvdh\DomPDF\ServiceProvider', 'Biscolab\ReCaptcha\ReCaptchaServiceProvider', 'Fideloper\Proxy\TrustedProxyServiceProvider', 'hisorange\BrowserDetect\ServiceProvider', 'Intervention\Image\ImageServiceProvider', 'Lab404\Impersonate\ImpersonateServiceProvider', 'Laravel\Dusk\DuskServiceProvider', 'Laravel\Tinker\TinkerServiceProvider', 'Collective\Html\HtmlServiceProvider', 'Laravelista\Comments\ServiceProvider', 'Maatwebsite\Excel\ExcelServiceProvider', 'Mpociot\Teamwork\TeamworkServiceProvider', 'Carbon\Laravel\ServiceProvider', 'Spatie\Honeypot\HoneypotServiceProvider', 'Spatie\MediaLibrary\MediaLibraryServiceProvider', 'Spatie\StripeWebhooks\StripeWebhooksServiceProvider', 'Spatie\WebhookClient\WebhookClientServiceProvider', 'Yajra\DataTables\DataTablesServiceProvider', 'YbrNX\MariaDB\MariaDBServiceProvider', 'PHPJasper\PHPJasperServiceProvider', 'Laravel\Tinker\TinkerServiceProvider', 'Intervention\Image\ImageServiceProvider', 'Collective\Html\HtmlServiceProvider', 'Yajra\DataTables\DataTablesServiceProvider', 'Spatie\MediaLibrary\MediaLibraryServiceProvider', 'Lab404\Impersonate\ImpersonateServiceProvider', 'Barryvdh\DomPDF\ServiceProvider', 'App\Providers\AppServiceProvider', 'App\Providers\AuthServiceProvider', 'App\Providers\EventServiceProvider', 'App\Providers\RouteServiceProvider', 'Barryvdh\DomPDF\ServiceProvider', 'Biscolab\ReCaptcha\ReCaptchaServiceProvider'))
in Application.php line 593
at Application->registerConfiguredProviders()
in RegisterProviders.php line 17
at RegisterProviders->bootstrap(object(Application))
in Application.php line 219
at Application->bootstrapWith(array('Illuminate\Foundation\Bootstrap\LoadEnvironmentVariables', 'Illuminate\Foundation\Bootstrap\LoadConfiguration', 'Illuminate\Foundation\Bootstrap\HandleExceptions', 'Illuminate\Foundation\Bootstrap\RegisterFacades', 'Illuminate\Foundation\Bootstrap\RegisterProviders', 'Illuminate\Foundation\Bootstrap\BootProviders'))
in Kernel.php line 156
at Kernel->bootstrap()
in Kernel.php line 140
at Kernel->sendRequestThroughRouter(object(Request))
in Kernel.php line 110
at Kernel->handle(object(Request))
in index.php line 55
I have checked and DuskServiceProvider.php is present in the vendor \laravel\dusk\src folder
The app and artisan were running fine right up until that erroneous command artisan run:migration and instantly this error breaks everything
Since dusk is to do with running in dev mode, would that have something to do with it?
Also, happy to share my code, just don't know what to share that relates to this. The migration I was creating at the time was never run as artisan broke before I got that far. Let me know if you can think of any code we should look at.
@Hondaman900 You could clone again then have the clone in a folder and the broken in another folder. Then using a tool like winmerge compare differences between the two. That may reveal what broke.
But I mention this only if you are that curious, as you may not have the time.
So, after hours searching and using Notepad++'s plugin to compare files, I could find nothing that would constitute a significant difference, nor could I find any missing files, and thus gave up on the quest to find out what happened.
I backed up everything, renamed my .ENV and the view I was working on, and copied the original working site code over the broken one. I renamed-back my old copy .ENV and view to their correct names and everything ran as expected, including artisan and I ran the migration successfully.
Though we didn't figure this out I truly appreciate all the assistance with this weird one. Thank you.
Please or to participate in this conversation.