运行composer安装后缺少bin/console


bin/console missing after running composer install

希望有人能帮我解决这个问题。

我的项目(在github上https://github.com/irvingswiftj/iceMarkt)在运行composer install时,似乎运行得很顺利,直到运行更新后的命令。在其中,我最终出现以下错误(当添加param-vvv时):

    Updating the "app/config/parameters.yml" file
    Could not open input file: bin/console
    Script Sensio'Bundle'DistributionBundle'Composer'ScriptHandler::clearCache handling the post-update-cmd event terminated with an exception
    [RuntimeException]                                                         
    An error occurred when executing the "'cache:clear --no-warmup'" command.  

如果我现在浏览我的项目目录,我可以看到bin/console从未创建过!

我已经删除了bin目录,假设可执行控制台文件将在我的下一次composer安装中创建。我错了!不要gitignore您的bin/comporter文件,还要确保如果您使用的是symfony 3文件夹结构,则symfony 2文件夹结构没有.gignore。

我也遇到了同样的问题,因为我被要求将bin目录添加到我的.gitignore文件中,因为在Symfony2中,所有bin文件(包括其他供应商的文件)都放在该文件夹中,但在Symfony 3中不是这样,所以我们可以将bin目录添加到我们的代码存储库中。

您可以解决安装新应用程序(使用symfony安装程序)和将bin目录从这个新项目复制到您自己的项目的问题。

使用Symfony 4/Symfony Flex,您需要安装symfony/console包:

composer require symfony/console

然后使用您的项目目录:

./bin/console

由于文件本身是以shebang #!/usr/bin/env php开头的,因此您可以在没有php的情况下立即执行它。

安装了新版本的Symfony和Flex后,

composer --force recipes:install symfony/console

这将产生垃圾箱/控制台。如果它已经存在,但您需要更新它,请使用

composer recipes:update symfony/console
composer recipes

只是列出你的食谱。