Livewire's JavaScript file returns 404 and components do nothing
GET /livewire/livewire.js net::ERR_ABORTED 404 (Not Found)Short answer
Livewire serves its JavaScript through a Laravel route, so a 404 means the request never reached that route. The usual reasons are a web server rule that blocks the path, a stale route cache, or disabled asset injection without the @livewireScripts directive. Publishing the assets removes the route dependency.
Fix it fast
1Find out which cause you have
Open the browser network tab and copy the exact URL of the failing script request, then see whether the page source contains a script tag for it at all.
php artisan route:list | grep -i livewire curl -s https://example.com | grep -i "livewire"2Match what you see, then jump to its fix
- 1
route:list on the server lacks the Livewire script route, or the app was deployed with cached routes from before the package was installed.Stale route cacheFix - 2
The route exists in route:list, but the script URL still returns 404 through the web server.The web server blocks the script pathFix - 3
The page source has no Livewire script tag, so the browser never asks for one.Asset injection is off and the directive is missingFix
- 1
What does the error look like?
GET /livewire/livewire.js net::ERR_ABORTED 404 (Not Found)Livewire components render but wire:click and wire:model do nothing
Cause 1 of 3
Stale route cache
1Check
The Livewire installation page lists cached routes as one cause of the 404.
php artisan route:list | grep -i livewire2Fix
Clear the route cache, and rebuild it after the deploy if you use it.
php artisan route:clear
php artisan route:cache3Verify
The route list now includes Livewire's route and the script loads.
php artisan route:list | grep -i livewireConfirmed by livewire.laravel.com
Cause 2 of 3
The web server blocks the script path
1Check
The script path contains a hash derived per installation, so a location rule for static files can swallow it and return 404 before PHP runs. The Livewire page names nginx rules as a cause.
sudo nginx -T | grep -n "location"2Fix
Make sure the path is handed to Laravel's front controller, or publish the assets so the file is served as a real static file.
php artisan livewire:publish --assets3Verify
Request the script URL from the page source and expect a 200.
curl -s https://example.com | grep -i "livewire"Confirmed by livewire.laravel.com
Cause 3 of 3
Asset injection is off and the directive is missing
1Check
Livewire injects its assets automatically into pages that contain components. If inject_assets is disabled, or the page has no component, you must add the directives yourself.
grep -rn "inject_assets" config/livewire.php
grep -rn "livewireScripts" resources/views/2Fix
Put the styles directive in the head and the scripts directive before the closing body tag of the layout.
<head>
@livewireStyles
</head>
<body>
{{ $slot }}
@livewireScripts
</body>3Verify
Reload and confirm the script tag is in the page source.
curl -s https://example.com | grep -i "livewire"Confirmed by livewire.laravel.com
How do I stop it coming back?
- Run php artisan route:clear in the deploy script before route:cache so routes match the installed packages.
- Check the Livewire script URL after changing nginx rules or adding a CDN in front of the site.
- If you publish assets, keep them current by re-running the publish command after Livewire updates.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
- stegnor.comMy company site: 804 pages from a Python and Jinja generator, with 15 free browser tools.
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
- Spotless LaundryAn on-demand laundry app: Flutter on a Laravel back end, with Firebase for live updates.
Related fixes
Back end
Laravel routes return 404 or throw NotFoundHttpException
Symfony\Component\HttpKernel\Exception\NotFoundHttpException
A 404 means Laravel found no route for that URL, or the request never reached Laravel at all.
3 causes, each with a fixBack end
Laravel file upload returns 413 behind nginx
413 Content Too Large
A 413 means a limit refused the request body before Laravel could use it.
3 causes, each with a fixBack end
PHP stops the script after 30 seconds
Symfony\Component\ErrorHandler\Error\FatalError: Maximum execution time of 60 seconds exceeded
PHP ends a script that runs past max_execution_time (30 seconds by default for web requests).
5 causes, each with a fixBack end
Composer says the gd extension is missing on a Laravel project
composer install or composer update stops on a package that requires ext-gd
Composer refuses to install a package that requires ext-gd when the PHP binary running Composer has no GD extension.
4 causes, each with a fixBack end
Why a Filament panel feels slow on a Laravel server
The panel is fast on a small demo and slow once there are many resources, pages and widgets
A slow Filament panel on a server is most often running without the production caches.
3 causes, each with a fixBack end
Intervention Image will not save the file in a Laravel app
Can't write image data to path (/var/www/app/public/uploads/photo.jpg)
Intervention Image writes straight to a file path.
3 causes, each with a fix