php 使用 composer 在非空文件夹上安装包
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26356399/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Install package on non-empty folder using composer
提问by Abudayah
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 ?
我试图通过 composer 安装包,但它一直告诉我这个目录不是空的,所以我如何使用 composer 在非空文件夹上安装包?有强制安装命令吗?
error message:
错误信息:
[InvalidArgumentException]
Project directory Yii-GZero-2b/ is not empty.
回答by Prisoner
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.
你目前不能。GitHub 上正在进行讨论,您可以在此处阅读: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.
但是现在,您需要创建一个新目录,然后迁移您的文件,反之亦然。
回答by Umesh Patil
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.
对我来说,授予文件夹写访问权限非常有效。在 Windows 上,我右键单击提到的文件夹并取消选中只读复选框并保存它并且它起作用了。也许你也可以尝试一下,希望它也适合你。
回答by Melih Polat
For Docker, I delete all docker related files after starting the container, run composer and then put files back to the folder.
对于 Docker,我在启动容器后删除所有与 Docker 相关的文件,运行 Composer,然后将文件放回文件夹。
回答by muTheTechie
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
回答by Yogesh
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.
Folder 必须为空,这是必需的,因为当您运行 create-project 时,composer 旨在从头开始创建一个完全干净的全新项目。