Symfony 3.3 ScriptHandler不能自动加载

时间:2017-11-06 12:01:05

标签: symfony composer-php capistrano autoload gitlab-ci

我使用Capistrano 3.10.0gitlab-ci(和泊坞窗)一起部署到制作中,但composer 1.5.2似乎没有自动加载ScriptHandler。<登记/> 注意: composer.lock 是最新的。

这是capistrano错误:

01 Generating optimized autoload files
01 > Incenteev\ParameterHandler\ScriptHandler::buildParameters
01 Updating the "app/config/parameters.yml" file
01 Class Sensio\Bundle\DistributionBundle\Composer\ScriptHandler is not autoloadable, can not call symfony-scripts script
01 Class Sensio\Bundle\DistributionBundle\Composer\ScriptHandler is not autoloadable, can not call symfony-scripts script
01 Class Sensio\Bundle\DistributionBundle\Composer\ScriptHandler is not autoloadable, can not call symfony-scripts script
01 Class Sensio\Bundle\DistributionBundle\Composer\ScriptHandler is not autoLoadable, can not call symfony-scripts script
01 Class Sensio\Bundle\DistributionBundle\Composer\ScriptHandler is not autoloadable, can not call symfony-scripts script
01 deploy@IP 3.002s
00:07 npm:install
01 npm install --production --silent --no-progress
01 added 3 packages in 0.619s
01 deploy@IP 2.613s
00:10 deploy:set_permissions:check
ERROR Cannot change permissions: /home/app/releases/20171106125307/var/logs is not a file or directory (Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as deploy@IP: Cannot change permissions: /home/app/releases/20171106125307/var/logs is not a file or directory

var/logs dir未创建,部署失败。

composer.json

{
    "name": "MyApp",
    "description": "MyApp description",
    "license": "proprietary",
    "type": "project",
    "autoload": {
        "psr-4": {
            "": "src/"
        },
        "classmap": [
            "app/AppKernel.php",
            "app/AppCache.php"
        ]
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "require": {
        "php": ">=7.0",
        "ext-mbstring": "*",
        "ext-soap": "*",
        "symfony/symfony": "^3.3",
        "doctrine/orm": "^2.5",
        "doctrine/doctrine-bundle": "^1.6",
        "symfony/swiftmailer-bundle": "^2.3",
        "symfony/monolog-bundle": "^3.0",
        "symfony/polyfill-apcu": "^1.0",
        "sensio/framework-extra-bundle": "^3.0.2",
        "incenteev/composer-parameter-handler": "^2.0",
        "symfony/assetic-bundle": "^2.8",
        "nesbot/carbon": "^1.22",
        "symfony/workflow": "^3.3",
        "twig/extensions": "^1.4",
        "stof/doctrine-extensions-bundle": "^1.2",
        "csa/guzzle-bundle": "^2.0",
        "symfony/dotenv": "^3.3",
        "sensio/distribution-bundle": "^5.0",
        "beberlei/assert": "^2.7"
    },
    "require-dev": {
        "sensio/generator-bundle": "^3.0",
        "symfony/phpunit-bridge": "^3.0",
        "doctrine/doctrine-fixtures-bundle": "^2.3",
        "fzaninotto/faker": "^1.6",
        "friendsofphp/php-cs-fixer": "^2.6",
        "phpunit/phpunit": "^5.6",
        "jakub-onderka/php-parallel-lint": "^0.9.2",
        "edgedesign/phpqa": "^1.16"
    },
    "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"
        },
        "branch-alias": null
    }
}

有什么遗失吗?

1 个答案:

答案 0 :(得分:0)

gitlab-cicapistrano之间发生了混乱。我试图使用develop分支部署到生产,而capistrano正在获取master(带有composer.json buggued)......

以上配置正常。