Permission denied when trying to self-update composer
Asked Answered
C

3

14

When I am trying to self-update my composer, I get "Permission Denied" error.

Even when I use sudo /usr/bin/composer.phar self-update, it shows me command not found.

Please help me I have no idea about composer

Caine answered 31/3, 2016 at 21:38 Comment(10)
try su instead of sudoAkene
Try to call it with PHP directly. php composer.phar selfupdateMilestone
it show an error message su: SorryCaine
@Milestone It show me` Could not open input file: composer.phar` when trying Could not open input file: composer.pharvCaine
Well, you have to give its full path if the .phar file is not in your current directory.Milestone
pharv you have an extra v.. from pasting?Uprear
currently i face sudo: /usr/local/bin/composer.phar: command not found problem sry typing error just nowCaine
Add -vvv to the command to get full verbose debugging output. Without that it's just a guessing game.Susceptible
sudo -H composer self-update fix my bugCaine
This worked for me check if composer is in dir and check complete file name in this case I don't have .phar extension: sudo /usr/local/bin/composer self-updateMcnally
E
8

Try following command:

sudo php /usr/bin/composer.phar self-update

Make sure composer.phar file exist in "/usr/bin"

Execution answered 2/4, 2016 at 8:45 Comment(3)
i'm having same error as above. and the composer.phar file does not exist in the usr/bin.Credenza
You can try this command even when composer self-update is giving error of Permission Denied.Sorcerer
Please note that (currently) running the selfupdate command with sudo, changes the owner of the cache directories inside your current users homedir. In order to avoid derived permission problems, change back ownership of the cache directories: sudo chown -R <user>:<group> /home/<user>/.composerSanies
S
6

CentOS7

sudo /usr/local/bin/composer self-update
Stigmasterol answered 12/1, 2020 at 4:53 Comment(0)
D
0

here are the instructions from the composer maintainers

On the official Composer website (getcomposer.org) in the section headed "self-update", the maintainers give the following information:

If you have installed Composer for your entire system (see global installation), you may have to run the command with root privileges

sudo -H composer self-update

If Composer was not installed as a PHAR, this command is not available. (This is sometimes the case when Composer was installed by an operating system package manager.)

what's sudo -H?

from man sudo:

-H, --set-home

Request that the security policy set the HOME environment variable to the home directory specified by the target user's password database entry. Depending on the policy, this may be the default behavior.

Daigle answered 28/3 at 17:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.