起初,对这个愚蠢的问题感到抱歉,但我像Symfony一样在Heroku中是新来的。我正在学习Symfony,现在尝试将我的应用程序部署到Heroku。但是在推送到heroku之后,我有错误无法解决。我搜索了答案,但没有找到解决方案。我的环境切换到PROD。这是我认为可以用来分析的文件堆。
Initializing repository, done.
Counting objects: 8783, done.
Delta compression using up to 3 threads.
Compressing objects: 100% (7959/7959), done.
Writing objects: 100% (8783/8783), 6.34 MiB | 499.00 KiB/s, done.
Total 8783 (delta 2737), reused 0 (delta 0)
-----> PHP app detected
-----> Resolved composer.lock requirement for PHP >=5.3.3 to version 5.6.2.
-----> Installing system packages...
- PHP 5.6.2
- Apache 2.4.10
- Nginx 1.6.0
-----> Installing PHP extensions...
- zend-opcache (automatic; bundled, using 'ext-zend-opcache.ini')
-----> Installing dependencies...
Composer version 1.0-dev (a309e1d89ded6919935a842faeaed8e888fbfe37) 2014-10-20 19:16:14
! WARNING: You have put Composer's vendor directory under version control.
That directory should not be in your Git repository; only composer.json
and composer.lock should be added, with Composer handling installation.
Please 'git rm --cached vendor/' to remove the folder from your index,
then add '/vendor/' to your '.gitignore' list to remove this notice.
For more information, refer to the Composer FAQ: http://bit.ly/1rlCSZU
Loading composer repositories with package information
Installing dependencies from lock file
- Removing sensio/generator-bundle (v2.4.0)
Generating optimized autoload files
Updating the "app/config/parameters.yml" file
PHP Fatal error: Class 'Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle' not found in /tmp/build_a721f054a4c0177a8e4e060c5b747b1c/app/AppKernel.php on line 26
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.
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] [--ignore-platform-reqs] [packages1] ... [packagesN]
! Push rejected, failed to compile PHP app
这是composer.json的内容:
{
"name": "symfony/framework-standard-edition",
"license": "MIT",
"type": "project",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-0": { "": "src/", "SymfonyStandard": "app/" }
},
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.5.*",
"doctrine/orm": "~2.2,>=2.2.3",
"doctrine/doctrine-bundle": "~1.2",
"twig/extensions": "~1.0",
"symfony/assetic-bundle": "~2.3",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~3.0",
"sensio/framework-extra-bundle": "~3.0",
"incenteev/composer-parameter-handler": "~2.0",
"sensio/generator-bundle": "~2.4"
},
"require-dev": {
},
"scripts": {
"post-root-package-install": [
"SymfonyStandard\\Composer::hookRootPackageInstall"
],
"post-install-cmd": [
"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::removeSymfonyStandardFiles"
],
"post-update-cmd": [
"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::removeSymfonyStandardFiles"
]
},
"config": {
"bin-dir": "bin"
},
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
},
"branch-alias": {
"dev-master": "2.5-dev"
}
}
}
和AppKernel.php内容:
<?php
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new Irishdash\StorageBundle\IrishdashStorageBundle(),
);
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
$bundles[] = new Acme\DemoBundle\AcmeDemoBundle();
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
}
return $bundles;
}
public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
}
}
首先,请遵循Heroku警告中收到的指示。
请'git rm --cached vendor /'从索引中删除文件夹,然后在'.gitignore'中添加'/ vendor /'。
然后将.gitignore文件的更改提交到Git。
接下来,它正在从锁定文件中安装依赖项,但是看起来您已将sensio/generator-bundle
软件包移至require
from中require-dev
。
鉴于此,请尝试运行php composer.phar update
,然后将composer.lock
文件的更改提交给Git。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句