It appears that unless I use sudo
my composer command fails to create a Laravel project.
Without sudo
it gives me the following error:
[ErrorException]
copy(/Users/H/.composer/cache/files/laravel/laravel/73094f2633f1b90f3ef
6de4a8a5b610532510e0e.zip): failed to open stream: Permission denied
What am I missing here?
If you ever execute:
sudo composer <anything>
Some of your composer home files (~/.composer/
) will be written by the root
and if you can't delete or write over them again unless you use sudo
to become root, so you have 2 options:
1) Change the user of those files back to your own:
sudo chown $USER:$USER -R ~/.composer
Or on a mac
sudo chown -R $USER:staff ~/.composer
2) Delete the whole folder (and lose your cache) to restart from scratch:
sudo rm -rf ~/.composer/cache
or even
sudo rm -rf ~/.composer
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With