Error “could not delete” with Composer on Vagrant

前端 未结 16 1068
闹比i
闹比i 2020-12-14 05:45

I have a Vagrant running Linux and I\'m trying to install Symfony.

After the command composer create-project symfony/framework-standard-edition ./ \"2.5.*\"

相关标签:
16条回答
  • 2020-12-14 06:14

    Another thing to check for, Composer needs to run in the context of a directory it has permissions to.

    In my case I was trying to issue a create-project command from /var/www, aimed against /var/www/html. /var/www is owned by root, /var/www/html is owned by the same user I executed Composer as (www-data). I got the following error; Could not delete /var/www/html/:

    Issued the same Composer command from within /var/www/html itself and it worked perfectly.

    0 讨论(0)
  • 2020-12-14 06:15

    It happened once to me and it turns out that I was hitting composer's timeout.

    You could take the following measures to gain some speed:

    1. Increase composer process-timeout (default 300) (not really needed if the following settings will help you gain speed, but can't hurt)
    2. Set dist as preferred install type.
    3. Enable https protocol for github, which is faster.

    ~/.composer/config.json

    {
        "config": {
            "process-timeout":      600,
            "preferred-install":    "dist",
            "github-protocols":     ["https"]
        }
    }
    

    If you still have problems after that, you can also clear composer's cache:

    rm -rf ~/.composer/cache
    
    0 讨论(0)
  • 2020-12-14 06:16

    On AWS I got this error while deploying Yii framework project there was this

    /var/app/current/vendor/

    folder i deleted everything inside it came back to my document root and ran composer update it fetched all the repos again.

    0 讨论(0)
  • 2020-12-14 06:16

    In my case , by removing the plugin and re-create the box solve the issue.

    0 讨论(0)
  • 2020-12-14 06:16

    I have solved the problem by creating a mount : In /home/vagrant create a folder named vendor then apply command : mount --bind /home/vagrant/vendor /path/to/source/vendor

    0 讨论(0)
  • 2020-12-14 06:23

    I've came across this issue and spent quite some time making a research. I've tried every single possible option to fix it but none of them worked for me. For me the bug occured on GNU/Linux host with Vagrant and VirtualBox provider.

    It turns out it's a VirtualBox bug related to the file system layer and race conditions when creating/deleting files. It occurs only for VirtualBox shared folders, not for regular ones. The sad part is that it seems like it's not going to be fixed any time soon.

    Some guys reported that they were able to solve the problem using the following tricks:

    • Downgrading to VirtualBox version 6.0.4.
    • Using nfs or rsync instead of shared folders.
    • Patching composer to add some pauses after certain operations.
    • Disabling plugin usage with --no-plugins option.

    But all of this seemed dirty to me. I personally was able to use a workaround suggested on GitHub which is to configure composer to install packages from sources. That's a simple and kind of clean trick which should not have significant negative side effects on your workflow. Try putting the following config into your ~/.config/composer/config.json. Or instead you can edit your composer.json accordingly depending on your needs. Keep in mind that composer.json will override your global config.

    {
        "config": {
            "preferred-install": "source"
        }
    }
    
    0 讨论(0)
提交回复
热议问题