warpig's avatar
Level 12

Cant install/update league/flysystem

First I was just trying to run composer require league/flysystem-aws-s3-v3 and I would typically get a list of problems associated with the current version, heres that list:

Problem 1
    - league/flysystem-aws-s3-v3[2.0.0, ..., 2.x-dev] require league/flysystem ^2.0.0 -> found league/flysystem[2.0.0-alpha.1, ..., 2.x-dev] but the package is fixed to 1.1.3 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
    - league/flysystem-aws-s3-v3[2.0.0-alpha.1, ..., 2.0.0-alpha.2] require league/flysystem 2.0.0-alpha.1 -> found league/flysystem[2.0.0-alpha.1] but the package is fixed to 1.1.3 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
    - league/flysystem-aws-s3-v3[2.0.0-alpha.4, ..., 2.0.0-beta.1] require league/flysystem 2.0.0-alpha.3 -> found league/flysystem[2.0.0-alpha.3] but the package is fixed to 1.1.3 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
    - league/flysystem-aws-s3-v3[2.0.0-beta.2, ..., 2.0.0-beta.3] require league/flysystem ^2.0.0-beta.1 -> found league/flysystem[2.0.0-beta.1, ..., 2.x-dev] but the package is fixed to 1.1.3 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
    - league/flysystem-aws-s3-v3 2.0.0-RC1 requires league/flysystem ^2.0.0-RC1 -> found league/flysystem[2.0.0-RC1, ..., 2.x-dev] but the package is fixed to 1.1.3 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
    - Root composer.json requires league/flysystem-aws-s3-v3 ^2.0 -> satisfiable by league/flysystem-aws-s3-v3[2.0.0-alpha.1, ..., 2.x-dev].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

So what I was able to figure out through the forums.was to put this:

    "require": {
        "league/flysystem-aws-s3-v3": "^1.0"
    },

In composer.json and then composer update league/flysystem-aws-s3-v3. After it I tried to require it again but the list of problems still persisted. So naturally now I want to know which version my project is running on, went into the composer "main" settings and looked at all of the commands, and decided I wanted to know what composer is "suggesting" right now, and I found out it had a suggestion for this particular package:

laravel/framework suggests:
league/flysystem-cached-adapter: Required to use the Flysystem cache (^1.0).

So it may be that it's looking at the version I added in the json but it still needs an upgrade or something. So then I run composer why league/flysystem and outputs this:

laravel/framework           v8.26.1  requires  league/flysystem (^1.1)     
league/flysystem-aws-s3-v3  1.0.29   requires  league/flysystem (^1.0.40)  

It amazes me how incredible easy it is sometimes to work with Laravel, in my Controllers, store() all I need to include is, 's3' inside the path variable, I've included the example of mine here:

    public function store(Request $request)
    {
        $this->validatePost($request);

        $post = new Post(request(['title', 'body', 'slug', 'image_url', 'category_id', 'is_approved']));

        if ($post->is_approved = $request->has('status')) {
        }

        if ($post->image_url = $request->has('image')) {
            $fileExtension = request('image')->getClientOriginalName();
            $fileName = pathInfo($fileExtension, PATHINFO_FILENAME);
            $extension = request('image')->getClientOriginalExtension();
            $newFileName = $fileName . '_' . time() . '.' . $extension;
// this line includes the 's3' option
            $imgPath = request('image')->storeAs('public/img/post_uploads', 's3', $newFileName);
            $post->image_url = $newFileName;
        } 
            $user = auth()->user();
            $post->user_id = $user->id;
            $post->save();
            $post->tags()->attach(request('tags'));
            
        return redirect('/posts');
    }

So it's crazy easy how this should behave but I can't make use of this because it won't let me install or even update the dependency as of now. Help!

The error, currently thrown whenever I want to upload a file is this:

Disk [18813744_10155528954939742_4304028984842100774_n_1614122481.jpg] does not have a configured driver. 
0 likes
4 replies
tykus's avatar
tykus
Best Answer
Level 104

Make sure you are getting version 1 - Laravel v9 will (very very likely) support Flysystem v2, but not yet.

composer require league/flysystem-aws-s3-v3 "~1.0"
3 likes
warpig's avatar
Level 12

Ok, cool, when is v9 coming out? Is there a date yet? That just succesfully installed the package. In the case of the update, would I have to require v2?

Please or to participate in this conversation.