I’ve deployed my laravel 10 – livewire 3 apps on local server (office LAN server) but it seems the js assets of livewire did’t loaded properly :
Loading failed for the with source
“http://10.62.230.18:81/livewire/livewire.js?id=e2b302e9”.
This is my config file of asset url :
'url' => env('APP_URL', 'http://10.62.230.18:81'),
'asset_url' => env('ASSET_URL', 'http://10.62.230.18:81'),
This is my layout page which load the livewire’s assets :
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ $title ?? 'WIP' }}</title>
@vite('resources/css/app.css')
</head>
<body>
{{ $slot }}
@stack('scripts')
</body>
</html>
I tried solutions this solution, however it didn’t work for me because there is no publishable assets for livewire:assets
How to solve this issue ?
2
Answers
I’ve run into similar issues with livewire.
When livewire assets haven’t loaded for me it’s usually due to a difference between a local environment and the production environment.
I’ve always solved it by explicitly defining the assets in the the blade layout file. In your case I would try:
I would also suggest that you run
composer update
from command line after you deploy.Also you may have cache files that were deployed unintentionally.
To resolve that try removing the cache files by running
If all else fails, then it is likely a permissions issue with the
/livewire/livewire.js
and/or/livewire/livewire.css
files. (i.e. the permissions are too strict)Lastly, if you’re building from Alpine, there are other troubleshooting options. Since I dont work with alpine the best resource I can provide is the official docs: https://livewire.laravel.com/docs/installation#manually-bundling-livewire-and-alpine
You can try reference the livewire assests from AppServiceProvider.php