Home » Php » php – Install package on non-empty folder using composer

php – Install package on non-empty folder using composer

Posted by: admin April 23, 2020 Leave a comment

Questions:

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.
How to&Answers:

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 visa-versa.

Answer:

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.

Answer:

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

Answer:

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

Answer:

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.