Install package on non-empty folder using composer

68,891

Solution 1

You currently can't. There is/was a discussion going on over on GitHub which you can read about here: https://github.com/composer/composer/issues/1135.

For now however, you'll need to create a new directory and then migrate your files over, or vice-versa.

Solution 2

You can check all the . files in the folder.

$ ls -la

Delete any . file in the folder and try again. It worked for me.

Solution 3

For me giving the folder write access worked very well. On windows I right clicked on the mentioned folder and unchecked the Read Only checkbox and saved it and it worked. May be you could also give it a try hope it will work for you as well.

Share:
68,891

Related videos on Youtube

Abudayah
Author by

Abudayah

Front End Software Engineer

Updated on July 09, 2022

Comments

  • Abudayah
    Abudayah almost 2 years

    I tried to install package via composer but it's keep telling me that this directory is not empty so how can I install package on non-empty folder using composer ? is there force install command ?

    error message:

      [InvalidArgumentException]
      Project directory Yii-GZero-2b/ is not empty.
    
  • Tanoro
    Tanoro over 5 years
    I agree with cwallenpoole. I consider it a bug. I'm running VirtualBox using Vagrant. My vagrantfile contains the configs for the VM and needs to be in the project directory to run the VM. That means CakePHP won't install in the project directory because it is not empty with the VM configs there. This needs a solution.
  • Luis Milanese
    Luis Milanese almost 5 years
    I really don't understand all those downvotes. The author said more or less the same as what the chosen answer said.
  • Chris
    Chris almost 4 years
    Thanks! I did ls -ls which didnt show the hidden .gitignore file.