Filamentphp v3.2 中出现“Filament\Forms\Components\FieldSet not found”错误

问题描述 投票:0回答:2

我在使用 Filament 部署 Laravel 项目时遇到了一个奇怪的问题。一切都在我的本地环境(Windows)上完美运行,但是当我将代码移动到我的生产服务器(Ubuntu)时,我收到以下错误:

Class "Filament\Forms\Components\FieldSet" not found

奇怪的是,这在我的本地机器上完美运行。我已经仔细检查了文件的大小写敏感性,并且在部署后在服务器上运行了composer install命令。

详情如下:

本地机器:Windows 11 服务器:Ubuntu 20.04 Laravel 版本:11 灯丝版本:3.2 关于可能导致此问题的任何想法? Composer.json

{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The skeleton application for the Laravel framework.",
    "keywords": ["laravel", "framework"],
    "license": "MIT",
    "require": {
        "php": "^8.2",
        "althinect/filament-spatie-roles-permissions": "^2.2",
        "arbermustafa/filament-locationpickr-field": "2.0.0",
        "awcodes/filament-quick-create": "^3.4",
        "bezhansalleh/filament-language-switch": "^3.1",
        "bezhansalleh/filament-shield": "^3.2",
        "blade-ui-kit/blade-heroicons": "^2.4",
        "filament/filament": "^3.2",
        "laravel/framework": "^11.9",
        "laravel/sanctum": "^4.0",
        "laravel/tinker": "^2.9",
        "malzariey/filament-daterangepicker-filter": "^3.0",
        "outhebox/blade-flags": "^1.5",
        "propaganistas/laravel-phone": "^5.3",
        "solution-forest/filament-access-management": "^2.2",
        "spatie/laravel-permission": "^6.9",
        "spatie/laravel-translatable": "^6.8",
        "ysfkaya/filament-phone-input": "^3.1"
    },
    "require-dev": {
        "fakerphp/faker": "^1.23",
        "laravel/pint": "^1.13",
        "laravel/sail": "^1.26",
        "mockery/mockery": "^1.6",
        "nunomaduro/collision": "^8.0",
        "phpunit/phpunit": "^11.0.1"
    },
    "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",
            "@php -r \"file_exists('database/database.sqlite') || touch('database/database.sqlite');\"",
            "@php artisan migrate --graceful --ansi"
        ]
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true,
        "allow-plugins": {
            "pestphp/pest-plugin": true,
            "php-http/discovery": true
        }
    },
    "minimum-stability": "dev",
    "prefer-stable": true
}

提前致谢!

这是我已经尝试过的方法,但问题仍然存在:

删除了

vendor
文件夹并再次运行composer安装。 删除整个项目文件夹,进行新的 git 克隆,然后运行安装步骤。 在另一台 Windows 机器上测试了相同的代码,并且运行良好。 将文件夹权限设置为
755
并将所有者设置为 www-data:www-data 我尝试过清除缓存(
php artisan config:clear
php artisan cache:clear
等),但问题仍然存在。我不确定这是否与操作系统差异或其他原因有关。

laravel ubuntu deployment laravel-filament filamentphp
2个回答
1
投票

我已经确定了问题所在,可以通过比较版本来解决。您当前使用的版本大于 3,这需要在 Fieldset 中使用小写的 's' 而不是 FieldSet:

https://filamentphp.com/docs/3.x/forms/layout/fieldset

0
投票

我解决了它,我写了

FieldSet
而不是
Fieldset
,但现在它在本地工作,在服务器上不起作用。

© www.soinside.com 2019 - 2024. All rights reserved.