Skip to content
Latchkey

Laravel "League\Flysystem ... not installed" driver in CI

Laravel builds a storage disk through Flysystem. Each driver (s3, ftp, sftp) needs its adapter package. If a test or command uses a disk whose adapter is not installed, Laravel throws "Please install the ... Flysystem adapter." Add the adapter or use the local/fake disk in tests.

What this error means

A Storage::disk('s3') call fails with "InvalidArgumentException: Please install the AWS S3 Flysystem adapter (composer require league/flysystem-aws-s3-v3)."

php
  InvalidArgumentException

  Please install the AWS S3 Flysystem adapter:
  composer require league/flysystem-aws-s3-v3 "^3.0"

Common causes

The adapter package is not installed

The disk driver in config/filesystems.php needs a specific Flysystem adapter that composer.json does not require, so building the disk fails.

Tests exercise a cloud disk directly

A test uses the real S3 disk instead of a fake, so it needs the adapter (and credentials) that CI lacks.

How to fix it

Install the required adapter

  1. Read which adapter the exception names.
  2. Require it in composer so the disk can be built.
  3. Re-run the command or test.
Terminal
composer require league/flysystem-aws-s3-v3 "^3.0"

Fake the disk in tests

Use Storage::fake() so tests use an in-memory disk and need no cloud adapter or credentials.

tests/Feature/UploadTest.php
use Illuminate\Support\Facades\Storage;

Storage::fake('s3');

How to prevent it

  • Require the Flysystem adapter for every disk you use.
  • Use Storage::fake() in tests instead of real cloud disks.
  • Keep the default disk to local in the testing env.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →