Composer无法执行应用程序/控制台缓存:清除symfony 3

时间:2015-12-17 21:13:55

标签: composer-php symfony

我无法运行composer install,因为它在执行post-install-cmd - 脚本时失败。

原因是Symfony 3将控制台应用程序从app文件夹移动到bin文件夹。

我已经尝试了composer clear-cachecomposer self-update,因此我可以验证我运行最新版本的作曲家而没有任何运气......任何人都可以帮助我吗?

composer diagnose

的结果
composer diagnose
Checking composer.json: FAIL
Defining autoload.psr-4 with an empty namespace prefix is a bad idea for performance
require.symfony/symfony : unbound version constraints (dev-master) should be avoided
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com rate limit: OK
Checking disk free space: OK
Checking composer version: OK

编辑: 添加了我的composer.json文件:Pastie

额外的部分:

"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"
    }
}

Composer出错:

Could not open input file: app/console
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-install-cmd event terminated with an exception



  [RuntimeException]                                                         
  An error occurred when executing the "'cache:clear --no-warmup'" command:  
  Could not open input file: app/console                                     
  .                                                                          

bin/composer cache:clear的手动测试:

bin/console cache:clear

 // Clearing the cache for the dev environment with debug true


 [OK] Cache for the "dev" environment (debug=true) was successfully cleared.                                            

问题回复:https://bitbucket.org/Richardh87/messenger

4 个答案:

答案 0 :(得分:32)

有同样的问题。发现var目录丢失了。

var目录添加到项目根目录为我解决了这个问题。看起来symfony 3尝试使用旧的项目结构,如果缺少var文件夹。希望这可以帮助别人。

答案 1 :(得分:8)

尝试

sudo rm -rf vendor/* 

sudo rm -rf composer.lock 

然后运行

composer install 

再次

答案 2 :(得分:2)

composer.json文件名中的额外配置密钥检查为symfony-bin-dir

因此请检查作曲家是否包含正确的配置键,例如:

composer.json

....
"extra": {
    "symfony-app-dir": "app",
    "symfony-bin-dir": "bin",
    "symfony-var-dir": "var",
    ....

答案 3 :(得分:0)

Changing the gitignore worked for me, like this:

# Cache and logs (Symfony3)
/var/cache/*
/var/logs/*
!var/cache/.gitkeep
!var/logs/.gitkeep

# Parameters
/app/config/parameters.yml
/app/config/parameters.ini

# Managed by Composer
/app/bootstrap.php.cache
/var/bootstrap.php.cache
/bin/*
!bin/console
!bin/symfony_requirements
/vendor/

# Assets and user uploads
/web/bundles/
/web/uploads/

# Assets managed by Bower
/web/assets/vendor/

# PHPUnit
/app/phpunit.xml
/phpunit.xml

# Build data
/build/

# Composer PHAR
/composer.phar