Thursday, January 6, 2022

[FIXED] Composer update failed: composer.phar file could not be written

Issue

I am trying to run the php composer.phar self-update command for my composer.phar file for my laravel project.

When I run this I get the following error:

Composer update failed: the "/Applications/MAMP/htdocs/*******/**********/composer.phar" file could not be written

I have looked at the permissions, and I do have read and write access for composer.phar on this machine.

Any ideas what could be going on?


Solution

Try to apply permissions not to the composer.phar but to the entire directory. Sometimes you have permission for a file (like chmod 777 ./dir/file.ext), but not for the directory. In that case, you may try to chmod 777 -R ./dir and that will give you total access to the directory.

P.S.: 777 is just an example, you may put any permissions you may think you need. But, at least for a test, I strongly recommend you to try that first. If won't work we will know that permission wasn't the issue at all.



Answered By - Dennis Braga

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.