新的 Symfony 3 安装:无法打开输入文件:作曲家安装中的 app/console

2022-01-21 00:00:00 php symfony composer-php

我通过官方 symfony-installer (http://symfony.com/download).完成第一件事后,我将项目提交给 Git,并在前几天将其克隆到另一台计算机上.克隆后我运行composer install"来安装所有的 symfony 依赖项.现在问题来了:脚本 ScriptHandler::clearCache 停止并出现错误:Could not open input file: app/console.没错——symfony3 有一个新的目录结构——所以console 现在驻留在/bin 中——而不是/app.如何告诉作曲家/项目使用新结构而不是旧结构?

I installed a fresh symfony3-instance via the official symfony-installer (http://symfony.com/download). After doing the first things, I commited the project to Git and cloned it the other day on another computer. After the cloning I ran "composer install" to install all the symfony-dependencies. Now comes the problem: The script ScriptHandler::clearCache stops with an error: Could not open input file: app/console. Thats right - symfony3 has a new directory-structure - so the console resides now in /bin - not in /app. How can I tell composer/the project to use the new structure instead of the old one?

我在这里阅读(什么是新的 Symfony 3 目录结构?) 关于控制台命令 SENSIOLABS_ENABLE_NEW_DIRECTORY_STRUCTURE=true - 但这在我的情况下不起作用.

I read here (What is the new Symfony 3 directory structure?) about the console-command SENSIOLABS_ENABLE_NEW_DIRECTORY_STRUCTURE=true - but that doesn't work in my case.

有什么建议吗?

推荐答案

ScriptHandlercomposer.json 文件名中的额外配置键中获取目录为 <代码>symfony-bin-dir.所以检查作曲家是否包含正确的配置密钥,例如:

The ScriptHandler take the dir from the extra config key in the composer.json files names as symfony-bin-dir. So check that the composer contain the correct configuration key, as example:

composer.json

....
"extra": {
    "symfony-app-dir": "app",
    "symfony-bin-dir": "bin",
    "symfony-var-dir": "var",
    ....

问题与作曲家的缓存有关.使用命令清除它已解决:

The problem was related to the cache of composer. It was solved clearing it with the command:

>php composer.phar clear-cache

希望这会有所帮助.

相关文章