Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/symfony/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Symfony 3.1.4 clearCache脚本需要生成器捆绑包开发包_Php_Symfony_Composer Php - Fatal编程技术网

Php Symfony 3.1.4 clearCache脚本需要生成器捆绑包开发包

Php Symfony 3.1.4 clearCache脚本需要生成器捆绑包开发包,php,symfony,composer-php,Php,Symfony,Composer Php,在使用“symfony new”命令生成的新项目上,当使用--no dev参数运行composer install时,出现以下错误: remote: > symfony-scripts: Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache remote: remote: Fatal error: Class 'Sensio\Bundle\GeneratorBundle\SensioGeneratorBund

在使用“symfony new”命令生成的新项目上,当使用--no dev参数运行composer install时,出现以下错误:

remote: > symfony-scripts: Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache
remote:
remote: Fatal error: Class 'Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle' not found in D:\home\site\wwwroot\app\AppKernel.php on line 25
remote: .....
remote: Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the symfony-scripts event terminated with an exception
remote:
remote:                                                                                                             
remote:   [RuntimeException]                                                                                        
remote:   An error occurred when executing the ""cache:clear --no-warmup"" command:                                 
remote:   Fatal error: Class 'Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle' not found in D:\home\site\wwwroot\app\AppKernel.php on line 25
remote:   .                                                                                                         
remote:                                                                                                             
remote:
remote: An error has occurred during web site deployment.
remote: Exception trace:
remote: Composer install failed
remote:  () at D:\home\site\wwwroot\vendor\sensio\distribution-bundle\Composer\ScriptHandler.php:307
remote:  Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::executeCommand() at D:\home\site\wwwroot\vendor\sensio\distribution-bundle\Composer\ScriptHandler.php:138
remote:  Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache() at phar://D:/home/site/wwwroot/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php:255
remote:  Composer\EventDispatcher\EventDispatcher->executeEventPhpScript() at phar://D:/home/site/wwwroot/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php:209
remote:  Composer\EventDispatcher\EventDispatcher->doDispatch() at phar://D:/home/site/wwwroot/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php:80
remote:  Composer\EventDispatcher\EventDispatcher->dispatch() at phar://D:/home/site/wwwroot/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php:193
remote:  Composer\EventDispatcher\EventDispatcher->doDispatch() at phar://D:/home/site/wwwroot/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php:95
remote:  Composer\EventDispatcher\EventDispatcher->dispatchScript() at phar://D:/home/site/wwwroot/composer.phar/src/Composer/Installer.php:297
remote:  Composer\Installer->run() at phar://D:/home/site/wwwroot/composer.phar/src/Composer/Command/InstallCommand.php:135
remote:  Composer\Command\InstallCommand->execute() at phar://D:/home/site/wwwroot/composer.phar/vendor/symfony/console/Command/Command.php:259
remote:  Symfony\Component\Console\Command\Command->run() at phar://D:/home/site/wwwroot/composer.phar/vendor/symfony/console/Application.php:847
remote:  Symfony\Component\Console\Application->doRunCommand() at phar://D:/home/site/wwwroot/composer.phar/vendor/symfony/console/Application.php:192
remote:  Symfony\Component\Console\Application->doRun() at phar://D:/home/site/wwwroot/composer.phar/src/Composer/Console/Application.php:231
remote:  Composer\Console\Application->doRun() at phar://D:/home/site/wwwroot/composer.phar/vendor/symfony/console/Application.php:123
remote:  Symfony\Component\Console\Application->run() at phar://D:/home/site/wwwroot/composer.phar/src/Composer/Console/Application.php:104
remote:  Composer\Console\Application->run() at phar://D:/home/site/wwwroot/composer.phar/bin/composer:43
remote:  require() at D:\home\site\wwwroot\composer.phar:24
clearCache安装后cmd似乎需要sensio/generator捆绑包。 但是,它列在我下面复制的default composer.json的require dev部分中

{
    "name": "benjat/hellosf",
    "license": "proprietary",
    "type": "project",
    "autoload": {
        "psr-4": {
            "": "src/"
        },
        "classmap": [
            "app/AppKernel.php",
            "app/AppCache.php"
        ]
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "require": {
        "php": ">=5.5.9",
        "symfony/symfony": "3.1.*",
        "doctrine/orm": "^2.5",
        "doctrine/doctrine-bundle": "^1.6",
        "doctrine/doctrine-cache-bundle": "^1.2",
        "symfony/swiftmailer-bundle": "^2.3",
        "symfony/monolog-bundle": "^2.8",
        "symfony/polyfill-apcu": "^1.0",
        "sensio/distribution-bundle": "^5.0",
        "sensio/framework-extra-bundle": "^3.0.2",
        "incenteev/composer-parameter-handler": "^2.0"
    },
    "require-dev": {
        "sensio/generator-bundle": "^3.0",
        "symfony/phpunit-bridge": "^3.0"
    },
    "scripts": {
        "symfony-scripts": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
        ],
        "post-install-cmd": [
            "@symfony-scripts"
        ],
        "post-update-cmd": [
            "@symfony-scripts"
        ]
    },
    "extra": {
        "symfony-app-dir": "app",
        "symfony-bin-dir": "bin",
        "symfony-var-dir": "var",
        "symfony-web-dir": "web",
        "symfony-tests-dir": "tests",
        "symfony-assets-install": "relative",
        "incenteev-parameters": {
            "file": "app/config/parameters.yml"
        }
    }
}
我尚未更新安装程序生成的代码,我的AppKernel registerBundles方法包含以下内容:

public function registerBundles()
{
    $bundles = [
        new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
        new Symfony\Bundle\SecurityBundle\SecurityBundle(),
        new Symfony\Bundle\TwigBundle\TwigBundle(),
        new Symfony\Bundle\MonologBundle\MonologBundle(),
        new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
        new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
        new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
        new AppBundle\AppBundle(),
    ];

    if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {
        $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
        $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
        $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
        $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
    }

    return $bundles;
}

这是clearCache脚本中的错误吗?在默认的composer.json文件中?在默认的registerBundles方法中?在我看来?

问题在于,您试图在不将symfony env导出到prod的情况下安装composer而不使用dev参数。请参阅文档:

如果在此步骤中出现“未找到类”错误,则可能需要在运行此命令之前运行
export SYMFONY_ENV=prod
,以便在prod环境中运行安装后cmd脚本


你能给我看看你的appKernel内容吗?在问题中更新了。