AwsS3Adapter异常出现在本地,但不在开发服务器中

时间:2019-05-29 10:50:18

标签: php laravel flysystem

我在Laravel项目中本地工作,突然开始出现以下异常:

ErrorException in FilesystemManager.php line 193: Class 'League\Flysystem\AwsS3v3\AwsS3Adapter' not found (View: /Users/mypetproject/resources/views/layouts/topheader.blade.php) (View: /Users/mypetproject/resources/views/layouts/topheader.blade.php) (View: /Users/mypetproject/resources/views/layouts/topheader.blade.php)

此版本正在服务器上运行,没有任何问题。为了验证,我签出了相同的分支,比较了composer.jsoncomposer.lock文件,它们在本地和服务器上都是相同的,做了一个composer update以防万一,但仍然失败本地,但不在服务器中。 .env文件也相同。

FilesystemManager位于vender / laravel / framework / src / Illuminate / Filesystem中,并且确实尝试进行use League\Flysystem\AwsS3v3\AwsS3Adapter as S3Adapter;,但是服务器上运行的版本也是如此。

请注意,我根本没有使用S3,并且由于我没有使用league/flysystem-aws-s3-v3,所以我真的不想安装它。

有什么主意吗?

这是我的composer.json

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": ">=5.5.9",
        "laravel/framework": "5.3.*",
        "laravelcollective/html": "5.3.*",
        "guzzlehttp/guzzle": "^6.2",
        "google/cloud-storage": "1.1.5"
    },
    "require-dev": {
        "fzaninotto/faker": "~1.4",
        "mockery/mockery": "0.9.*",
        "phpunit/phpunit": "~4.0",
        "phpspec/phpspec": "~2.1"
    },
    "autoload": {
        "classmap": [
            "database"
        ],
        "psr-4": {
            "App\\": "app/"
        }
    },
    "autoload-dev": {
        "classmap": [
            "tests/TestCase.php"
        ]
    },
    "scripts": {
        "post-install-cmd": [
            "php artisan clear-compiled",
            "php artisan optimize"
        ],
        "post-update-cmd": [
            "php artisan clear-compiled",
            "php artisan optimize"
        ],
        "post-root-package-install": [
            "php -r \"copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "php artisan key:generate"
        ]
    },
    "config": {
        "preferred-install": "dist"
    },
    "minimum-stability": "dev",
    "prefer-stable": true
}

1 个答案:

答案 0 :(得分:0)

我终于在供应商/撰写者/

中找到了autoload_static.phpautoload_classmap.php文件

由于某种原因,它引用了错误的文件(以前使用S3引用了一个文件):

'App\\IsoClasses\\IsoStorage' => __DIR__ . '/../..' . '/app/IsoClasses/IsoStorageS3.php',

更新为

'App\\IsoClasses\\IsoStorage' => __DIR__ . '/../..' . '/app/IsoClasses/IsoStorage.php',

现在可以使用了。

奇怪的是,开发服务器的文件也有此文件,但是它可以在开发服务器中正常工作。