39

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.
Abudayah
  • 3,599
  • 6
  • 37
  • 56

6 Answers6

50

You currently cant. 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.

mega6382
  • 8,624
  • 16
  • 43
  • 65
Prisoner
  • 25,993
  • 10
  • 68
  • 97
  • 7
    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. – Tanoro Nov 15 '18 at 21:40
1

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.

Umesh Patil
  • 3,595
  • 28
  • 22
1

You can check all the . files in the folder.

$ ls -la

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

Sudhanshu Bajaj
  • 173
  • 1
  • 5
0

For Docker, I delete all docker related files after starting the container, run composer and then put files back to the folder.

-4

Folder Must be blank, It's required because when you run create-project, composer aims to create a completely clean brand new project from scratch.

Yogesh
  • 39
  • 1
-4

Instead of run the command

composer.phar create-project flarum/flarum . --stability=beta

use the specific folder name, for example

composer.phar create-project flarum/flarum /var/www/html/forum/ --stability=beta
muTheTechie
  • 768
  • 9
  • 20