执行“'缓存时出错:clear --no-warmup'”

时间:2013-12-23 07:52:04

标签: symfony deployment capistrano capifony

清除缓存时,Capifony cap部署失败。

这些是日志。

我尝试过很多东西,比如做app / console cache:清除服务器和本地。

你能帮帮我吗?

$ cap staging deploy
--> Updating code base with remote_cache strategy
--> Creating cache directory................................✔
--> Creating symlinks for shared directories................✔
--> Creating symlinks for shared files......................✔
--> Normalizing asset timestamps............................✔
--> Updating Composer.......................................✔
--> Installing Composer dependencies........................✘
*** [err :: somsom.jp] [RuntimeException]
*** [err :: somsom.jp] An error occurred when executing the "'cache:clear --no-warmup'" command.
*** [err :: somsom.jp] 
*** [err :: somsom.jp] Exception trace:
*** [err :: somsom.jp] () at /var/www/html/somsom.jp/shared/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Composer/ScriptHandler.php:182
*** [err :: somsom.jp] Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::executeCommand() at /var/www/html/somsom.jp/shared/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Composer/ScriptHandler.php:62
*** [err :: somsom.jp] Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache() at phar:///var/www/html/somsom.jp/releases/20131223074835/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php:165
*** [err :: somsom.jp] Composer\EventDispatcher\EventDispatcher->executeEventPhpScript() at phar:///var/www/html/somsom.jp/releases/20131223074835/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php:138
*** [err :: somsom.jp] Composer\EventDispatcher\EventDispatcher->doDispatch() at phar:///var/www/html/somsom.jp/releases/20131223074835/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php:107
*** [err :: somsom.jp] Composer\EventDispatcher\EventDispatcher->dispatchCommandEvent() at phar:///var/www/html/somsom.jp/releases/20131223074835/composer.phar/src/Composer/Installer.php:288
*** [err :: somsom.jp] Composer\Installer->run() at phar:///var/www/html/somsom.jp/releases/20131223074835/composer.phar/src/Composer/Command/InstallCommand.php:110
*** [err :: somsom.jp] Composer\Command\InstallCommand->execute() at phar:///var/www/html/somsom.jp/releases/20131223074835/composer.phar/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:244
*** [err :: somsom.jp] Symfony\Component\Console\Command\Command->run() at phar:///var/www/html/somsom.jp/releases/20131223074835/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:897
*** [err :: somsom.jp] Symfony\Component\Console\Application->doRunCommand() at phar:///var/www/html/somsom.jp/releases/20131223074835/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:191
*** [err :: somsom.jp] Symfony\Component\Console\Application->doRun() at phar:///var/www/html/somsom.jp/releases/20131223074835/composer.phar/src/Composer/Console/Application.php:117
*** [err :: somsom.jp] Composer\Console\Application->doRun() at phar:///var/www/html/somsom.jp/releases/20131223074835/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:121
*** [err :: somsom.jp] Symfony\Component\Console\Application->run() at phar:///var/www/html/somsom.jp/releases/20131223074835/composer.phar/src/Composer/Console/Application.php:83
*** [err :: somsom.jp] Composer\Console\Application->run() at phar:///var/www/html/somsom.jp/releases/20131223074835/composer.phar/bin/composer:43
*** [err :: somsom.jp] require() at /var/www/html/somsom.jp/releases/20131223074835/composer.phar:15
*** [err :: somsom.jp] 
*** [err :: somsom.jp] 
*** [err :: somsom.jp] install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-plugins] [--no-custom-installers] [--no-scripts] [--no-progress] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader]
*** [err :: somsom.jp] 
*** [err :: somsom.jp] 
*** [deploy:update_code] rolling back
failed: "TERM=dumb sudo -u app /bin/sh -c 'sh -c '\\''cd /var/www/html/somsom.jp/releases/20131223074835 && php composer.phar install --no-dev --verbose --prefer-dist --optimize-autoloader --no-progress'\\'''" on somsom.jp

with logger.level = Logger :: MAX_LEVEL

--> Installing Composer dependencies
  * executing "sh -c 'cd /var/www/html/somsom.jp/releases/20131223135618 && php composer.phar install --no-dev --verbose --prefer-dist --optimize-autoloader --no-progress'"
    servers: ["somsom.jp"]
    [somsom.jp] executing command
 ** [out :: somsom.jp] Loading composer repositories with package information
 ** [out :: somsom.jp] Installing dependencies from lock file
 ** [out :: somsom.jp] 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.
 ** [out :: somsom.jp] Nothing to install or update
 ** [out :: somsom.jp] Generating autoload files
 ** [out :: somsom.jp] [Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException]
 ** [out :: somsom.jp] You have requested a non-existent parameter "locale".
 ** [out :: somsom.jp] Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-install-cmd event terminated with an exception
*** [err :: somsom.jp] [RuntimeException]
*** [err :: somsom.jp] An error occurred when executing the "'cache:clear --no-warmup'" command.
*** [err :: somsom.jp] 
*** [err :: somsom.jp] Exception trace:
*** [err :: somsom.jp] () at /var/www/html/somsom.jp/shared/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Composer/ScriptHandler.php:182
*** [err :: somsom.jp] Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::executeCommand() at /var/www/html/somsom.jp/shared/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Composer/ScriptHandler.php:62
*** [err :: somsom.jp] Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache() at phar:///var/www/html/somsom.jp/releases/20131223135618/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php:165
*** [err :: somsom.jp] Composer\EventDispatcher\EventDispatcher->executeEventPhpScript() at phar:///var/www/html/somsom.jp/releases/20131223135618/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php:138
*** [err :: somsom.jp] Composer\EventDispatcher\EventDispatcher->doDispatch() at phar:///var/www/html/somsom.jp/releases/20131223135618/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php:107
*** [err :: somsom.jp] Composer\EventDispatcher\EventDispatcher->dispatchCommandEvent() at phar:///var/www/html/somsom.jp/releases/20131223135618/composer.phar/src/Composer/Installer.php:288
*** [err :: somsom.jp] Composer\Installer->run() at phar:///var/www/html/somsom.jp/releases/20131223135618/composer.phar/src/Composer/Command/InstallCommand.php:110
*** [err :: somsom.jp] Composer\Command\InstallCommand->execute() at phar:///var/www/html/somsom.jp/releases/20131223135618/composer.phar/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:244
*** [err :: somsom.jp] Symfony\Component\Console\Command\Command->run() at phar:///var/www/html/somsom.jp/releases/20131223135618/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:897
*** [err :: somsom.jp] Symfony\Component\Console\Application->doRunCommand() at phar:///var/www/html/somsom.jp/releases/20131223135618/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:191
*** [err :: somsom.jp] Symfony\Component\Console\Application->doRun() at phar:///var/www/html/somsom.jp/releases/20131223135618/composer.phar/src/Composer/Console/Application.php:117
*** [err :: somsom.jp] Composer\Console\Application->doRun() at phar:///var/www/html/somsom.jp/releases/20131223135618/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:121
*** [err :: somsom.jp] Symfony\Component\Console\Application->run() at phar:///var/www/html/somsom.jp/releases/20131223135618/composer.phar/src/Composer/Console/Application.php:83
*** [err :: somsom.jp] Composer\Console\Application->run() at phar:///var/www/html/somsom.jp/releases/20131223135618/composer.phar/bin/composer:43
*** [err :: somsom.jp] require() at /var/www/html/somsom.jp/releases/20131223135618/composer.phar:15
*** [err :: somsom.jp] 
*** [err :: somsom.jp] 
*** [err :: somsom.jp] install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-plugins] [--no-custom-installers] [--no-scripts] [--no-progress] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader]
*** [err :: somsom.jp] 
*** [err :: somsom.jp] 
    command finished in 3638ms
*** [deploy:update_code] rolling back
  * executing "rm -rf /var/www/html/somsom.jp/releases/20131223135618; true"
    servers: ["somsom.jp"]
    [somsom.jp] executing command
    command finished in 152ms
failed: "TERM=dumb sudo -u app /bin/sh -c 'sh -c '\\''cd /var/www/html/somsom.jp/releases/20131223135618 && php composer.phar install --no-dev --verbose --prefer-dist --optimize-autoloader --no-progress'\\'''" on somsom.jp

它说'你已经请求了一个不存在的参数“locale”'

在我的config.yml中。它需要%locale%

imports:
    - { resource: parameters.yml }
    - { resource: security.yml }
    - { resource: "@AcmeAdminBundle/Resources/config/admin.yml"}


framework:
    translator:      { fallback: %locale% }

并在parameters.yml中。有区域价值。

parameters:    
    locale: ja

它在当地环境中正常工作。

服务器上有什么变化?

4 个答案:

答案 0 :(得分:1)

在我看来,我将转到app / cache目录和 rm -rf prod rm -rf dev

答案 1 :(得分:1)

deploy.rb中添加此行以查看更多详细信息:

logger.level = Logger::MAX_LEVEL

验证parameters.yml的内容,这是一个经常出现的问题。

答案 2 :(得分:0)

我对Capifony所遇到的问题非常感兴趣,因为我当时有很多问题。

这是我在Google上找到的内容: Capistrano: use a custom user instead of root with sudo

那么,你的deploy.rb中有一行与此类似吗?

set :default_shell,         "TERM=dumb sudo -u www-data /bin/sh"

答案 3 :(得分:0)

我遇到了同样的问题,因为我在AppKernel中注册了一个bundle(doctrine-fixture),但是使用了require-dev来安装它

所以处理缓存的composer.json部分(symfony标准版的“脚本”部分)在生成prod服务器时被搞砸了