F
Filament17mo ago
orrison

Issue with deployments after adding viteTheme() to Panel

It seems that adding viteTheme() to the Panel throws an error during fresh CI/CD deployment.
0/193 [>---------------------------] 0%
30/193 [====>-----------------------] 15%
50/193 [=======>--------------------] 25%
70/193 [==========>-----------------] 36%
90/193 [=============>--------------] 46%
100/193 [==============>-------------] 51%
110/193 [===============>------------] 56%
120/193 [=================>----------] 62%
130/193 [==================>---------] 67%
140/193 [====================>-------] 72%
160/193 [=======================>----] 82%
180/193 [==========================>-] 93%
193/193 [============================] 100%
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

Illuminate\Foundation\ViteManifestNotFoundException

Vite manifest not found at: /var/www/html/woof/releases/20230811143911/public/build/manifest.json

at vendor/laravel/framework/src/Illuminate/Foundation/Vite.php:708
704▕ $path = $this->manifestPath($buildDirectory);
705▕
706▕ if (! isset(static::$manifests[$path])) {
707▕ if (! is_file($path)) {
708▕ throw new ViteManifestNotFoundException("Vite manifest not found at: $path");
709▕ }
710▕
711▕ static::$manifests[$path] = json_decode(file_get_contents($path), true);
712▕ }

i Build the production assets: Run `npm run build` in your deployment script.
https://laravel.com/docs/9.x/vite#running-vite

+2 vendor frames 

3 app/Providers/Filament/AdminPanelProvider.php:46
Filament\Panel::viteTheme()
+1 vendor frames 

5 app/Providers/Filament/AdminPanelProvider.php:29
Filament\PanelProvider::register()

Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1
0/193 [>---------------------------] 0%
30/193 [====>-----------------------] 15%
50/193 [=======>--------------------] 25%
70/193 [==========>-----------------] 36%
90/193 [=============>--------------] 46%
100/193 [==============>-------------] 51%
110/193 [===============>------------] 56%
120/193 [=================>----------] 62%
130/193 [==================>---------] 67%
140/193 [====================>-------] 72%
160/193 [=======================>----] 82%
180/193 [==========================>-] 93%
193/193 [============================] 100%
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

Illuminate\Foundation\ViteManifestNotFoundException

Vite manifest not found at: /var/www/html/woof/releases/20230811143911/public/build/manifest.json

at vendor/laravel/framework/src/Illuminate/Foundation/Vite.php:708
704▕ $path = $this->manifestPath($buildDirectory);
705▕
706▕ if (! isset(static::$manifests[$path])) {
707▕ if (! is_file($path)) {
708▕ throw new ViteManifestNotFoundException("Vite manifest not found at: $path");
709▕ }
710▕
711▕ static::$manifests[$path] = json_decode(file_get_contents($path), true);
712▕ }

i Build the production assets: Run `npm run build` in your deployment script.
https://laravel.com/docs/9.x/vite#running-vite

+2 vendor frames 

3 app/Providers/Filament/AdminPanelProvider.php:46
Filament\Panel::viteTheme()
+1 vendor frames 

5 app/Providers/Filament/AdminPanelProvider.php:29
Filament\PanelProvider::register()

Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1
Am I doing something wrong, or does this mean I should be doing npm ci ; npm run build before composer install now?
2 Replies
josef
josef17mo ago
Is it during tests? Try adding $this->withoutVite(); to the setUp() method in TestCase
orrison
orrisonOP17mo ago
It is not. It is during a fresh deployment with a tool like Deployer or Laravel Envoyer. Or really during any fresh setup of the application. This is due to viteTheme() looking for the Vite manifest file. I have solved for this by changing my deployment process to work like this:
composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist

npm ci
npm run build

composer after-autoload
composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist

npm ci
npm run build

composer after-autoload
With my composer.json scripts looking like:
{
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@after-autoload"
],
"after-autoload": [
"@php artisan package:discover --ansi",
"@php artisan filament:upgrade"
],
}
{
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@after-autoload"
],
"after-autoload": [
"@php artisan package:discover --ansi",
"@php artisan filament:upgrade"
],
}
To keep local functionality the same, but avoid this issue during deployments
Want results from more Discord servers?
Add your server