【发布时间】:2017-05-21 18:25:53
【问题描述】:
整天工作将我的应用程序部署到heroku,但每次它都会抛出一个错误。而且我完全没有线索,并且有一个非常愤怒的客户。
当我尝试使用命令 git push heroku master 将我的项目添加到 heroku 时,一切都很好,直到需要清除缓存。
Updating the "app/config/parameters.yml" file
remote: > Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap
remote: > Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache
remote: Could not open input file: app/console
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: Could not open input file: app/console
remote: .
你会想,和这个git issue一样
还有一个已知问题,即我使用了错误类型的映射。
但我觉得还好。
我更新了作曲家并清除了作曲家的缓存
当我使用 php bin/console cache:clear 清除缓存时,一切都很好!
我跟着this教程 并从 symfony 站点获得了一些辅助信息。
还发现了这个stack - 解释了发生了什么,但这仍然不能解决我的问题。
也许它在我的作曲家文件中的某个地方,或者我的 git 忽略。 但老实说,我已经不知道了。
{
"name": "symfony/framework-standard-edition",
"license": "MIT",
"type": "project",
"description": "The \"Symfony Standard Edition\" distribution",
"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",
"friendsofsymfony/user-bundle": "~2.0@dev",
"symfony/assetic-bundle": "^2.8",
"stfalcon/tinymce-bundle": "2.0",
"egeloen/ckeditor-bundle": "^4.0",
"whiteoctober/tcpdf-bundle": "^1.0",
"gregwar/captcha-bundle": "^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"
],
"compile": [
"rm web/app_dev.php",
"bin/console cache:clear",
"bin/console assetic:dump"
]
},
"config": {
"platform": {
"php": "5.5.9"
}
},
"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": {
"dev-master": "3.1-dev"
}
}
}
【问题讨论】:
-
奇怪的
bin/console是一个Symfony3命令,而app/console是一个Symfony2命令。我想知道这是否与它有关? -
是的,symfony2 使用 app/console,而 symfony3 使用 bin/console。
-
这就是我的意思,也许你需要使用 Symfony 2.7 版而不是 3.1 版(或 2.8 版),因为目录结构已经改变。我不确定您是否可以更改 symfony 版本。
-
我可以更改 symfony 版本,但我真的不想这样做,heroku 支持 symfony3。另请参阅此链接 - stackoverflow.com/questions/34198591/…
-
见@Aerendir 的回答。我同意他的看法。看来您有一个 Symfony2 项目。您需要将其更新到 Symfony3。我在 SO 上看到很多关于用户从 Symfony2 转换到 symfony3 时遇到问题的帖子;原因是,他们尝试使用
easy way就像您尝试做的那样。