Composer: file_put_contents(./composer.json): failed to open stream: Permission denied

前端 未结 8 880
一生所求
一生所求 2020-12-12 14:49

I\'m trying to install Prestissimo to an Ubuntu 16.04 server, but that leads to an error:

$ composer global require \"hirak/prestissimo:^0.3\"
Changed curren         


        
相关标签:
8条回答
  • 2020-12-12 15:15

    I faced this issue as well but in my case, I was in wrong directory. Check the directory you are working

    0 讨论(0)
  • 2020-12-12 15:21

    I had this problem to install laravel/lumen.

    It can be resolved with the following command:

    $ sudo chown -R $USER ~/.composer/
    
    0 讨论(0)
  • 2020-12-12 15:21

    In my case I don't have issues with ~/.composer.
    So being inside Laravel app root folder, I did sudo chown -R $USER composer.lock and it was helpful.

    0 讨论(0)
  • 2020-12-12 15:21

    I was getting the same exception, but in my case I am using PowerShell to run commands So, I fixed this with an instruction to unblock multiple files first. PS C:\> dir C:\executable_file_Path\*PowerShell* | Unblock-File and then use the following to load the package & 'C:\path_to_executable\php.exe' "c:\path_to_composer_.phar_file\composer.phar "require desired/package

    0 讨论(0)
  • 2020-12-12 15:22

    To resolve this, you should open up a terminal window and type this command:

    sudo chown -R user ~/.composer (with user being your current user, in your case, kramer65)

    After you have ran this command, you should have permission to run your composer global require command.

    You may also need to remove the .composer file from the current directory, to do this open up a terminal window and type this command:

    sudo rm -rf .composer

    0 讨论(0)
  • 2020-12-12 15:26

    In my case I used sudo mkdir projectFolder to create folder. It was owned by root user and I was logged in using non root user.

    So I changed the folder permission using command sudo chown mynonrootuser:mynonrootuser projectFolder and then it worked fine.

    0 讨论(0)
提交回复
热议问题