Does anyone know how to fix this error "ERROR Command "filament:optimize" is not defined"?

php artisan filament:optimize ERROR Command "filament:optimize" is not defined. Did you mean one of these? ⇂ filament:assets ⇂ filament:check-translations ⇂ filament:install ⇂ filament:upgrade
34 Replies
DevShaded
DevShaded2w ago
You're sure that you are on v3? What available commands do you get when running php artisan filament?
Elías Culqui
Elías CulquiOP2w ago
Yes I have v3 php artisan filament Laravel Framework 10.48.25 Usage: command [options] [arguments] Options: -h, --help Display help for the given command. When no command is given display help for the list command -q, --quiet Do not output any message -V, --version Display this application version --ansi|--no-ansi Force (or disable --no-ansi) ANSI output -n, --no-interaction Do not ask any interactive question --env[=ENV] The environment the command should run under -v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug Available commands for the "filament" namespace: filament:assets Set up Filament assets. filament:check-translations Check for missing and removed translations filament:install Install Filament. filament:upgrade Upgrade Filament to the latest version
DevShaded
DevShaded2w ago
That weird because when I run that command I get this
php artisan filament
Laravel Framework 11.36.1

Usage:
command [options] [arguments]

Options:
-h, --help Display help for the given command. When no command is given display help for the list command
--silent Do not output any message
-q, --quiet Only errors are displayed. All other output is suppressed
-V, --version Display this application version
--ansi|--no-ansi Force (or disable --no-ansi) ANSI output
-n, --no-interaction Do not ask any interactive question
--env[=ENV] The environment the command should run under
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Available commands for the "filament" namespace:
filament:about Display basic information about Filament packages that are installed
filament:assets Set up Filament assets
filament:cache-components Cache all components
filament:check-translations Check for missing and removed translations
filament:clear-cached-components Clear all cached components
filament:install Install Filament
filament:optimize Cache components and Blade icons to increase performance
filament:optimize-clear Remove the cached components and Blad
php artisan filament
Laravel Framework 11.36.1

Usage:
command [options] [arguments]

Options:
-h, --help Display help for the given command. When no command is given display help for the list command
--silent Do not output any message
-q, --quiet Only errors are displayed. All other output is suppressed
-V, --version Display this application version
--ansi|--no-ansi Force (or disable --no-ansi) ANSI output
-n, --no-interaction Do not ask any interactive question
--env[=ENV] The environment the command should run under
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Available commands for the "filament" namespace:
filament:about Display basic information about Filament packages that are installed
filament:assets Set up Filament assets
filament:cache-components Cache all components
filament:check-translations Check for missing and removed translations
filament:clear-cached-components Clear all cached components
filament:install Install Filament
filament:optimize Cache components and Blade icons to increase performance
filament:optimize-clear Remove the cached components and Blad
try to run the php artisan filament:upgrade, and check again?
Elías Culqui
Elías CulquiOP2w ago
Yes, I already tried to update with php artisan filament:upgrade but I have the same error
DevShaded
DevShaded2w ago
How does the composer.json file look like? I want to see the version of the filament package
Elías Culqui
Elías CulquiOP2w ago
{ "name": "laravel/laravel", "type": "project", "description": "The Laravel Framework.", "keywords": ["framework", "laravel"], "license": "MIT", "require": { "php": "^8.1", "filament/filament": "3.0", "guzzlehttp/guzzle": "^7.2", "laravel/framework": "^10.0", "laravel/sanctum": "^3.2", "laravel/tinker": "^2.8" }, "require-dev": { "fakerphp/faker": "^1.9.1", "laravel/pint": "^1.0", "laravel/sail": "^1.18", "mockery/mockery": "^1.4.4", "nunomaduro/collision": "^7.0", "phpunit/phpunit": "^10.0", "spatie/laravel-ignition": "^2.0" }, "autoload": { "psr-4": { "App\\": "app/", "Database\\Factories\\": "database/factories/", "Database\\Seeders\\": "database/seeders/" } }, "autoload-dev": { "psr-4": { "Tests\\": "tests/" } }, "scripts": { "post-autoload-dump": [ "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", "@php artisan package:discover --ansi", "@php artisan filament:upgrade" ], "post-update-cmd": [ "@php artisan vendor:publish --tag=laravel-assets --ansi --force" ], "post-root-package-install": [ "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" ], "post-create-project-cmd": [ "@php artisan key:generate --ansi" ] }, "extra": { "branch-alias": { "dev-master": "10.x-dev" }, "laravel": { "dont-discover": [] } }, "config": { "optimize-autoloader": true, "preferred-install": "dist", "sort-packages": true, "allow-plugins": { "pestphp/pest-plugin": true } }, "minimum-stability": "stable", "prefer-stable": true }
DevShaded
DevShaded2w ago
Change this "filament/filament": "3.0" to "filament/filament": "^3.2" and do composer update You are on the wrong version of filament probs thats why it does not show up You should also update to laravel 11x 😁 (dont worry about that now)
Elías Culqui
Elías CulquiOP2w ago
I switched from v3.2 to v3.0 to try to fix the bug.
DevShaded
DevShaded2w ago
So that didn't work at all?
Elías Culqui
Elías CulquiOP2w ago
It didn't work for me I didn't know you could use Filament with Laravel 11
DevShaded
DevShaded2w ago
What does php artisan about --only=filament return?
Elías Culqui
Elías CulquiOP2w ago
php artisan about --only=filament Filament .........................................................................................................................................
Packages ......................................................................................... filament, forms, notifications, support, tables
Version ................................................................................................................................... v3.0.0
Views .............................................................................................................................. NOT PUBLISHED
DevShaded
DevShaded2w ago
Did you change back to version ^3.2?
Elías Culqui
Elías CulquiOP2w ago
No, but now yes. php artisan about --only=filament
Filament .........................................................................................................................................
Packages ......................................................................................... filament, forms, notifications, support, tables
Version ................................................................................................................................... v3.2.0
Views .............................................................................................................................. NOT PUBLISHED
DevShaded
DevShaded2w ago
And php artisan filament still outputs the same?
Elías Culqui
Elías CulquiOP2w ago
Yes
DevShaded
DevShaded2w ago
Hmm, what is you delete the vendor folder, and do a clean install again with composer install
Elías Culqui
Elías CulquiOP2w ago
I will try The error persists 🥲
DevShaded
DevShaded2w ago
😭 Hope the Filament developers see this, and can fix this soon
Elías Culqui
Elías CulquiOP2w ago
Yes, thank you very much for your help
DevShaded
DevShaded2w ago
No problem, sad to see this didn't help. Hope this can be fixed soon so you can deploy your app!
Elías Culqui
Elías CulquiOP2w ago
php artisan filament:optimize-clear and php artisan filament:optimize
DevShaded
DevShaded2w ago
How is the version still locked at v3.2.0? When I run that command i get this output...
php artisan about --only=filament

Filament ...........................................................................................................
Blade Icons ............................................................................................. NOT CACHED
Packages ........................................................... filament, forms, notifications, support, tables
Panel Components ........................................................................................ NOT CACHED
Version ................................................................................................... v3.2.131
Views ................................................................................................ NOT PUBLISHED
php artisan about --only=filament

Filament ...........................................................................................................
Blade Icons ............................................................................................. NOT CACHED
Packages ........................................................... filament, forms, notifications, support, tables
Panel Components ........................................................................................ NOT CACHED
Version ................................................................................................... v3.2.131
Views ................................................................................................ NOT PUBLISHED
Elías Culqui
Elías CulquiOP2w ago
I don't know
DevShaded
DevShaded2w ago
Does the composer.json look like this "filament/filament": "^3.2" With the little hat before the version number?
Elías Culqui
Elías CulquiOP2w ago
no
DevShaded
DevShaded2w ago
This is how my composer.json file looks like https://hastebin.com/share/mekawuwowa.swift
Hastebin
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
DevShaded
DevShaded2w ago
Couldnt paste it in here because I dont have nitro And this is based on laravel 11x btw
Elías Culqui
Elías CulquiOP2w ago
That was the error , I updated with composer upgrade and I no longer have the error 🥳 Thank you so much bro!
DevShaded
DevShaded2w ago
Very very nice! Well, now I dont need to be sad becacuse I couln't help you 😄 Time to deploy now haha
Elías Culqui
Elías CulquiOP2w ago
Yes, now to deploy, thanks again bro
DevShaded
DevShaded2w ago
No problem!
Mohamed Ayaou
Mohamed Ayaou2w ago
Don't forget to make this thread "Solved"

Did you find this page helpful?