How To Solve Laravel Please Provide A Valid Cache Path Issue

Hello Friends,
Today I was working on a laravel project and faced one error, which wasted lots of time. I thought many developers may face the same issue. Let's talk about the error. While installing the composer I see the exception "Provide a Valid Cache Path issue". I hope many of us have faced the same issue.
This issue looks like below.

Let's Jump to the solution part.

Solution 1

Mostly this issue is related to the storage folder. So, We need to work on the storage folder. Let's check the permission to the storage/framework folder.

cd storage/
chmod -R 775 framework
chown -R www-data:www-data framework


Solution 2

Our second step is to create the following folders in the storage folder manually and give permission. You can run the following commands in the terminal.

sudo mkdir storage/framework
sudo mkdir storage/framework/sessions
sudo mkdir storage/framework/views
sudo mkdir storage/framework/cache
sudo mkdir storage/framework/cache/data

sudo chmod -R 777 storage 

After that, we need to clear the cache by running the following command.

php artisan cache:clear

If the cache is not cleared yet. Then go to bootstrap/cache directory. And delete all files and sub directories inside the bootstrap/cache directory.

You can solve this issue by following these solutions.