运行composer install时出错执行\“'缓存时出错:clear --no-warmup'\”命令:

时间:2017-11-16 17:17:54

标签: php symfony vagrant ansible composer-php

我正在尝试启动一个Vagrant机器(带有ansible),当它进入“composer install”任务时会抛出错误。我搜索了这个问题并尝试了多种不起作用的解决方案(如下所述)。

我相信它与没有权限写入app / cache和app / log的vagrant用户有关,即使我更改了VM和本地的权限。不确定解决方案是什么。

错误:

  

失败:[默认](item = composer install)=> {“已更改”:true,“cmd”:   [“composer”,“install”],“delta”:“0:00:06.144861”,“结束”:“2017-11-16   12:03:03.366269“,”失败“:true,”item“:”composer install“,”rc“:1,   “开始”:“2017-11-16 12:02:57.221408”,“stderr”:“正在加载作曲家   包含信息的存储库\ n安装依赖项   (包括require-dev)来自锁文件\ n无需安装或   更新\ n生成自动加载文件\ n>   Incenteev \ ParameterHandler \ ScriptHandler :: buildParameters \ n>   SENSIO \捆绑\ DistributionBundle \作曲\ ScriptHandler :: buildBootstrap \ n>   SENSIO \包\ DistributionBundle \作曲\ ScriptHandler :: clearCache \ nScript   SENSIO \包\ DistributionBundle \作曲\ ScriptHandler :: clearCache   处理以异常终止的symfony-scripts事件\ n \ n
  \ n [RuntimeException]
  \ n执行\“'缓存时出错:clear --no-warmup'\”   命令:
  \ n //使用debug true清除dev环境的缓存   \ n
  \ n [Symfony \ Component \ Filesystem \ Exception \ IOException]
  \ n无法删除目录   \“/ var / www / fisher.dev / app / cache / de~ / annotations \”:。
  \ n
  \ n cache:clear [--no-warmup] [--no-optional-warmers] [-h | --help]   [-q | --quiet] [-v | vv | vvv | --verbose] [-V | --version] [ - ansi] [ - no-ansi]   [-n | --no-interaction] [-s | --shell] [--process-isolation] [-e | --env   ENV] [ - no-debug] [ - ] \ n。
  \ n

Composer.json文件:

{
"name": "fostermadeco/fisher",
"license": "proprietary",
"type": "project",
"autoload": {
    "psr-4": {
        "": "src/"
    },
    "classmap": [
        "app/AppKernel.php",
        "app/AppCache.php"
    ]
},
"require": {
    "php": ">=5.3.9",
    "symfony/symfony": "2.8.*",
    "doctrine/orm": "^2.4.8",
    "doctrine/doctrine-bundle": "~1.4",
    "symfony/swiftmailer-bundle": "~2.3",
    "symfony/monolog-bundle": "~2.11.3",
    "sensio/distribution-bundle": "~5.0",
    "sensio/framework-extra-bundle": "^3.0.2",
    "incenteev/composer-parameter-handler": "~2.0",
    "snc/redis-bundle": "^2.0",
    "predis/predis": "^1.1",
    "doctrine/doctrine-migrations-bundle": "1.2.1",
    "alcaeus/mongo-php-adapter": "^1.0",
    "doctrine/mongodb-odm": "^1.2",
    "doctrine/mongodb-odm-bundle": "^3.2",
    "ocramius/package-versions": "^1.1",
    "ircmaxell/random-lib": "^1.2",
    "jms/serializer-bundle": "^1.1",
    "nelmio/api-doc-bundle": "^2.13",
    "maba/webpack-bundle": "^0.6.4",
    "stripe/stripe-php": "^4.3",
    "doctrine/annotations": "^1.3",
    "bugsnag/bugsnag-symfony": "^1.0",
    "stof/doctrine-extensions-bundle": "^1.2",
    "danielstjules/stringy": "^2.3",
    "doctrine/migrations": "1.4.1",
    "beberlei/DoctrineExtensions": "1.0.*"
},
"require-dev": {
    "sensio/generator-bundle": "~3.0",
    "symfony/phpunit-bridge": "~2.7",
    "doctrine/data-fixtures": "^1.2",
    "hautelook/alice-bundle": "^1.4"
},
"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"
    ]
},
"config": {
    "bin-dir": "bin"
},
"extra": {
    "symfony-app-dir": "app",
    "symfony-web-dir": "public",
    "symfony-assets-install": "relative",
    "incenteev-parameters": {
        "file": "app/config/parameters.yml"
    },
    "branch-alias": null
},
"minimum-stability": "dev"
}
  1. 我可以使用'php app / console cache:clear'和'php app / console cache:clear --no-warmup'

  2. 清除缓存
  3. 我也能'rm -rf app / cache / *'并且我已经更改了缓存文件夹'sudo chmod -R 777 app / cache'的权限

  4. 我使用ansible设置date.timezone ='America / New_York'

  5. 任何帮助都会非常感激!谢谢!

2 个答案:

答案 0 :(得分:1)

我发现问题出在我的操作系统macOS High Sierra v10.13.1上。目前这个os和vagrant有一个错误,它与Vagrant的文件同步,NFS和macOS上的文件映射有关。

更多信息: http://www.qed42.com/blog/macos-sierra-issues-vagrant

答案 1 :(得分:0)

问题似乎来自VM如何处理映射路径。

更改项目目录中文件的所有权和权限将从VM中执行而不会出现错误 - 但经过进一步调查,您可以看到所有权和权限实际上未被更改。