Symfony 2,autoload.php 在错误的目录中生成

Symfony 2, autoload.php generated in wrong directory

我正在使用 symfony 2 并尝试 运行 composer install --ignore-platform-reqs

它以前有效,但现在在新的设置上我收到错误 require_once(app/autoload.php): failed to open stream: No such file or directory

下面的完整错误:

Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.
Nothing to install or update
Generating autoload files
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap

Warning: require_once(app/autoload.php): failed to open stream: No such file or directory in /Users/macbook/www/myproject/source/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php on line 29

Fatal error: require_once(): Failed opening required 'app/autoload.php' (include_path='.:') in /Users/macbook/www/myproject/source/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php on line 29
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap handling the post-install-cmd event terminated with an exception


  [RuntimeException]                                     
  An error occurred when generating the bootstrap file.  

问题是它以前有效。所以看起来 app/autoload.php 总是在正确的位置。现在我正在进行全新安装,但它不在那里。

我能够在 vendors/autoload.php 中找到 autoload.php,但不确定为什么它位于错误的位置。

我的composer.json:

{
    "name": "symfony/framework-standard-edition",
    "description": "The \"Symfony Standard Edition\" distribution",
    "autoload": {
        "psr-0": { "": "src/" }
    },
    "require": {
        "php": ">=5.3.3",
        "symfony/symfony": "2.1.*",
        "doctrine/orm": ">=2.2.3,<2.4-dev",
        "doctrine/doctrine-bundle": "1.0.*",
        "twig/extensions": "1.0.*@dev",
        "symfony/assetic-bundle": "2.1.*",
        "symfony/swiftmailer-bundle": "2.1.*",
        "symfony/monolog-bundle": "2.1.*",
        "sensio/distribution-bundle": "2.1.*",
        "sensio/framework-extra-bundle": "2.1.*",
        "sensio/generator-bundle": "2.1.*",
        "jms/security-extra-bundle": "1.2.*",
        "jms/di-extra-bundle": "1.1.*",
        "kriswallsmith/assetic": "1.1.*@dev",
        "doctrine/mongodb-odm-bundle": "3.0.*",
        "snc/redis-bundle": "2.1.*@dev",
        "doctrine/doctrine-fixtures-bundle": "dev-master",
        "incenteev/composer-parameter-handler": "~2.0"
    },
    "minimum-stability": "dev",
    "scripts": {
        "post-install-cmd": [
            "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap",
            "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache",
            "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installAssets",
            "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installRequirementsFile"
        ],
        "post-update-cmd": [
            "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap",
            "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache",
            "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installAssets",
            "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installRequirementsFile"
        ],
        "update-parameters": [
            "Incenteev\ParameterHandler\ScriptHandler::buildParameters"
        ]
    },
    "extra": {
        "symfony-app-dir": "app",
        "symfony-web-dir": "web",
        "incenteev-parameters": {
            "file": "app/config/parameters.yml",
            "env-map": {
                "mongodb_server": "MONGODB_SERVER"

            }
        }
    }
}

安装后,composer 从这个文件运行一个脚本:ScriptHandler.php, which gets the path for config key symfony-app-dir and calls the next script from the file: build_bootstrap.php

如果您没有 autoload.php 文件,您可能需要从 autoload.php.dist 文件中复制它