Jonjos
Jonjos

Reputation: 11

Cannot create cache directory for Laravel project

I am trying to create my first Laravel project but i am having a problem with composer and some permissions (at least that's what i understand). When I open my cmd to create a new Laravel project , using this command (create-project laravel/laravel basicwebsite), I get an error. The error message is

“Cannot create cache directory C:\Mamp\htdocs/ C:\Users\giorg\AppData\Roaming\Composer/cache/repo/https---repo.packagist.org/, or directory is not writable. Proceeding without cache”. enter image description here

I am still new and I don’t know much but it seems that my folders are not writable or something similar. I am using MAMP and windows 10. Thanks in advance for your time.

Upvotes: 1

Views: 3973

Answers (2)

Mahmudul Hasan Sohag
Mahmudul Hasan Sohag

Reputation: 1069

If the folder is owned by root, even if you have admin privileges, you still dont have permission, this happens when you use sudo while installing composer.

It can be solved by

sudo chown -R $USER $HOME/.composer

Upvotes: 1

Dilip Hirapara
Dilip Hirapara

Reputation: 15296

The problem is with your composer installation, not the folder permissions.

You should probably install globally, but locally to your user, it should only be used by your user account and not by the web server

https://getcomposer.org/doc/00-intro.md#globally

Or

composer.phar create-project laravel/laravel basicwebsite
php composer.phar create-project laravel/laravel basicwebsite

Upvotes: 0

Related Questions