Tag Archives: “Please provide a valid cache path”

Solve the problem of “Please provide a valid cache path” in Laravel/Lumen

Solve the problem of “Please provide a valid cache path” in Laravel/Lumen

New project error:

    //error: 
    InvalidArgumentException in Compiler.php line 36:
    Please provide a valid cache path.

Error prompted by the error:

    // vendor/illuminate/view/Compilers/Compiler.php

    if (! $cachePath) {
        throw new InvalidArgumentException('Please provide a valid cache path.');
    }

This path is specified in config/cache.php and can be modified to other addresses by yourself:

// cache 
return [
    // ...
    'stores' => [
        // ...
        'file' => [
            'driver' => 'file',
            'path'   => storage_path('framework/cache'),
        ],
    ],
    // ...  
]

Create a directory:

mkdir -p storage/framework/views
 ✗ mkdir -p storage/framework/cache
 ✗ mkdir -p storage/framework/sessions

Make sure the storage directory structure is as follows:

./storage
├── app
├── framework
│   ├── cache
│   ├── sessions
│   └── views
└── logs
    └── lumen.log

Note that these directories must have read and write permissions.