简体   繁体   English

League\\Flysystem\\AwsS3v3\\AwsS3Adapter::__construct():参数 #1 ($client) 必须是 Aws\\S3Client 类型,Aws\\S3\\S3Client 给定

[英]League\\Flysystem\\AwsS3v3\\AwsS3Adapter::__construct(): Argument #1 ($client) must be of type Aws\\S3Client, Aws\\S3\\S3Client given

I have installed the s3 flysystem package by running the following composer command in my Laravel 8 project我通过在我的Laravel 8项目中运行以下 composer 命令安装了 s3 flysystem package

composer require --with-all-dependencies league/flysystem-aws-s3-v3 "^1.0"

and tried to store a file from the request as并尝试将请求中的文件存储为

$imageName = $request->file('file')->store('uploads');

I got the following error我收到以下错误

League\Flysystem\AwsS3v3\AwsS3Adapter::__construct(): Argument #1 ($client) must be of type Aws\S3Client, Aws\S3\S3Client given, called in D:\Projects\Rescale\vendor\laravel\framework\src\Illuminate\Filesystem\FilesystemManager.php on line 229 League\Flysystem\AwsS3v3\AwsS3Adapter::__construct():参数 #1 ($client) 必须是 Aws\S3Client 类型,Aws\S3\S3Client 给定,在 D:\Projects\Rescale\vendor\laravel\framework\ 中调用src\Illuminate\Filesystem\FilesystemManager.php 在第 229 行

So it seems ThePHPLeague Flysystem major version got updated (to v2) thus breaking a lot of stuff since latest Laravel depends on "^1.1" (see:https://github.com/laravel/framework/blob/8.x/composer.json#L27 ).因此,似乎 ThePHPLeague Flysystem 主要版本已更新(到 v2),因此破坏了很多东西,因为最新的 Laravel 依赖于“^1.1”(参见:https://github.com/laravel/framework/blob/8.x/composer .json#L27 )。

I've had this error, so my workaround is to use a specific version instead.我遇到了这个错误,所以我的解决方法是改用特定版本。


  1. Go to composer.json and use latest v1 (see: https://github.com/thephpleague/flysystem-aws-s3-v3/tags ). Go 到 composer.json 并使用最新的 v1(参见: https://github.com/thephpleague/flysystem-aws-s3-v3./tag
- "league/flysystem-aws-s3-v3": "^1.0",
+ "league/flysystem-aws-s3-v3": "1.0.29",
  1. Run composer update and let composer update your dependencies.运行composer update并让 composer 更新你的依赖。

try this to upload an image on AWS试试这个在 AWS 上上传图片

$path = Storage::disk('s3')->put('uploads', $request->file('file'));

try this尝试这个

composer require --with-all-dependencies league/flysystem-aws-s3-v3 "~1.0"

I got same error in Laravel version 8我在 Laravel 版本 8 中遇到了同样的错误

  1. open composer.json and change inside version to "league/flysystem-aws-s3-v3": "^1.0"打开composer.json并将内部版本更改为"league/flysystem-aws-s3-v3": "^1.0"
  2. run composer update运行composer update

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法使用 Laravel 5.7 上传 s3 存储桶中的文件-参数 1 传递给 League\\Flysystem\\AwsS3v3\\AwsS3Adapter: - Unable to upload file in s3 bucket using laravel 5.7- Argument 1 passed to League\Flysystem\AwsS3v3\AwsS3Adapter: 将文件上传到 S3。 Class 'League\Flysystem\AwsS3v3\AwsS3Adapter' 未找到 - Uploading files to S3. Class 'League\Flysystem\AwsS3v3\AwsS3Adapter' not found 错误:在文件中找不到 Class 'League\Flysystem\AwsS3v3\AwsS3Adapter' - Error: Class 'League\Flysystem\AwsS3v3\AwsS3Adapter' not found in file 错误:未找到 Class 'League\Flysystem\AwsS3v3\AwsS3Adapter' - Error: Class 'League\Flysystem\AwsS3v3\AwsS3Adapter' not found Lumen 8.x 文件系统不工作。 错误:未找到 Class 'League\Flysystem\AwsS3v3\AwsS3Adapter' - Lumen 8.x filesystem not working. Error: Class 'League\Flysystem\AwsS3v3\AwsS3Adapter' not found 从 Laravel 9 的存储外观获取 S3Client - Get S3Client from storage facade in Laravel 9 Laravel League/flysystem 使用 AWS S3 获取文件 URL - Laravel league/flysystem getting file URL with AWS S3 安装联赛/flysystem-aws-s3-v3 联赛/flysystem 时出现问题 ^2.0 需要,但卡在 1.1.3 - Problem installing league/flysystem-aws-s3-v3 league/flysystem ^2.0 required but stuck at 1.1.3 无法安装联赛/flysystem-aws-s3-v3 - Can't install league/flysystem-aws-s3-v3 尝试安装 composer League/flysystem-aws-s3-v3 时出现错误 - I got de error when I tried install composer league/flysystem-aws-s3-v3
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM