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
You're sure that you are on v3?
What available commands do you get when running
php artisan filament
?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 versionThat weird because when I run that command I get this
try to run the
php artisan filament:upgrade
, and check again?Yes, I already tried to update with
php artisan filament:upgrade
but I have the same errorHow does the
composer.json
file look like? I want to see the version of the filament package{
"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
}
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)I switched from v3.2 to v3.0 to try to fix the bug.
So that didn't work at all?
It didn't work for me
I didn't know you could use Filament with Laravel 11
What does
php artisan about --only=filament
return?php artisan about --only=filament
Filament .........................................................................................................................................Packages ......................................................................................... filament, forms, notifications, support, tables
Version ................................................................................................................................... v3.0.0
Views .............................................................................................................................. NOT PUBLISHED
Did you change back to version
^3.2
?No, but now yes.
php artisan about --only=filament
Filament .........................................................................................................................................
Packages ......................................................................................... filament, forms, notifications, support, tables
Version ................................................................................................................................... v3.2.0
Views .............................................................................................................................. NOT PUBLISHED
And
php artisan filament
still outputs the same?Yes
Hmm, what is you delete the
vendor
folder, and do a clean install again with composer install
I will try
The error persists 🥲
😭
Hope the Filament developers see this, and can fix this soon
Does any of the commands listed in the docs work? https://filamentphp.com/docs/3.x/panels/installation#caching-filament-components
Yes, thank you very much for your help
No problem, sad to see this didn't help. Hope this can be fixed soon so you can deploy your app!
php artisan filament:optimize-clear
and php artisan filament:optimize
How is the version still locked at v3.2.0? When I run that command i get this output...
I don't know
Does the composer.json look like this
"filament/filament": "^3.2"
With the little hat before the version number?no
Hastebin
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
Couldnt paste it in here because I dont have nitro
And this is based on laravel 11x btw
That was the error , I updated with
composer upgrade
and I no longer have the error 🥳
Thank you so much bro!Very very nice! Well, now I dont need to be sad becacuse I couln't help you 😄
Time to deploy now haha
Yes, now to deploy, thanks again bro
No problem!
Don't forget to make this thread "Solved"