I created a new Laravel project. When I go to the terminal to install the dependecies composer
displays the following warning:
Cannot create cache
I had the same problem today. Try it!
sudo chown -R [yourgroup] /home/[youruser]/.composer/cache/repo/https---packagist.org/
sudo chown -R [yourgroup] /home/[youruser]/.composer/cache/files/
Use this command:
sudo chown -R $USER ~/.composer/
Run this command :
sudo chown -R yourUser /home/yourUser/.composer
Change the group permission for the folder
sudo chown -R w3cert /home/w3cert/.composer/cache/repo/https---packagist.org
and the Files folder too
sudo chown -R w3cert /home/w3cert/.composer/cache/files/
I'm assuming w3cert is your username, if not change the 4th parameter to your username.
If the problem still persists try
sudo chown -R w3cert /home/w3cert/.composer
Now, there is a chance that you won't be able to create your app directory, if that happens do the same for your html folder or the folder you are trying to create your laravel project in.
Hope this helps.
I had a similar problem recently, and needed to change the permissions of my vendor folder
By running following commands :
php artisan cache:clear
chmod -R 777 storage vendor
composer dump-autoload
I need to give all the permissions required to open and write vendor files to solve this issue
When you installed composer pretty sure you used $ sudo
command because of that the ~/.composer
folder was created by the root.
Run this to fix the issue:
$ sudo chown -R $USER $HOME/.composer