所以.. 我一直在为我的单身汉项目构建一个带有Symfony3框架的应用程序,它在localhost上运行完美。在dev-environment和prod。
然而。当我试图将它部署到Heroku应用程序时,我得到以下日志..
Generating optimized autoload files
> Incenteev\ParameterHandler\ScriptHandler::buildParameters
Creating the "app/config/parameters.yml" file
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache
PHP Fatal error: Uncaught Error: Class 'Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle' not found in /tmp/build_68991520ff4642cdf86248159a2f0f54/Carante-getmoving-585074f/app/AppKernel.php:15
Stack trace:
#0 /tmp/build_68991520ff4642cdf86248159a2f0f54/Carante-getmoving-585074f/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(396): AppKernel->registerBundles()
#1 /tmp/build_68991520ff4642cdf86248159a2f0f54/Carante-getmoving-585074f/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(114): Symfony\Component\HttpKernel\Kernel->initializeBundles()
#2 /tmp/build_68991520ff4642cdf86248159a2f0f54/Carante-getmoving-585074f/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php(68): Symfony\Component\HttpKernel\Kernel->boot()
#3 /tmp/build_68991520ff4642cdf86248159a2f0f54/Carante-getmoving-585074f/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php(118): Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvI in /tmp/build_68991520ff4642cdf86248159a2f0f54/Carante-getmoving-585074f/app/AppKernel.php on line 15
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the symfony-scripts event terminated with an exception
[RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command:
PHP Fatal error: Uncaught Error: Class 'Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle' not found in /tmp/build_68991520ff4642cdf86248159a2f0f54/Carante-getmoving-585074f/app/AppKernel.php:15
Stack trace:
#0 /tmp/build_68991520ff4642cdf86248159a2f0f54/Carante-getmoving-585074f/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(396): AppKernel->registerBundles()
#1 /tmp/build_68991520ff4642cdf86248159a2f0f54/Carante-getmoving-585074f/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(114): Symfony\Component\HttpKernel\Kernel->initializeBundles()
#2 /tmp/build_68991520ff4642cdf86248159a2f0f54/Carante-getmoving-585074f/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php(68): Symfony\Component\HttpKernel\Kernel->boot()
#3 /tmp/build_68991520ff4642cdf86248159a2f0f54/Carante-getmoving-585074f/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php(118): Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvI in /tmp/build_68991520ff4642cdf86248159a2f0f54/Carante-getmoving-585074f/app/AppKernel.php on line 15
.
install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--ignore-platform-reqs] [--] [<packages>]...
! Push rejected, failed to compile PHP app.
! Push failed
或者至少这是它开始出错的地方。
我的AppKernel.php文件看起来像这样..
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = [
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 Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(),
new \Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle(),
new AppBundle\AppBundle(),
];
if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {
$bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
$bundles[] = new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle();
}
return $bundles;
}
如果我在AppKernel中注释掉Swiftmailer类,则另一个类会导致完全相同的问题。
我希望有人可以帮助我或至少更多地了解错误。
说实话,部署应用程序和处理任何服务器都不是我最强大的网站,因此非常深入。
谢谢...:)
答案 0 :(得分:0)
我开始认为这是一个文件权限问题,就像Gopal一样。这是关于需要设置的文件权限的文档:
https://symfony.com/doc/current/setup/file_permissions.html
Heroku有点不同,所以我没有任何指导,因为我之前没有尝试过。
答案 1 :(得分:0)
@AlvinBunk我已经恢复了各种文件夹中的权限,并建立了一个更稳定的互联网连接,之前的作曲家更新错误现在已经消失。
然而..现在我得到了与我尝试部署应用程序时相同的错误。
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the symfony-scripts event terminated with an exception
[RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command:
Fatal error: Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "SwiftmailerBundle" from namespace "Symfony\Bundle\SwiftmailerBundle".
Did you forget a "use" statement for another namespace? in /Users/carante/KEA/WebDeveloping/3. Semester/Bachelor/Application/getmoving-fiji/app/AppKernel.php:16
Stack trace:
#0 /Users/carante/KEA/WebDeveloping/3. Semester/Bachelor/Application/getmoving-fiji/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(396): AppKernel->registerBund
les()
#1 /Users/carante/KEA/WebDeveloping/3. Semester/Bachelor/Application/getmoving-fiji/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(114): Symfony\Component\HttpK
ernel\Kernel->initializeBundles()
#2 /Users/carante/KEA/WebDeveloping/3. Semester/Bachelor/Application/getmoving-fiji/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php(68): Symfony\C
omponent\HttpKernel\Kernel->boot()
#3 /Users/carante/KEA/WebDeveloping/3. Semester/Bachelor/Application/getm in /Users/carante/KEA/WebDeveloping/3. Semester/Bachelor/Application/getmoving-fiji/app/AppKernel.php on l
ine 16
PHP Fatal error: Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "SwiftmailerBundle" from namespace "Symfony\Bundle\SwiftmailerBundle".
Did you forget a "use" statement for another namespace? in /Users/carante/KEA/WebDeveloping/3. Semester/Bachelor/Application/getmoving-fiji/app/AppKernel.php:16
Stack trace:
#0 /Users/carante/KEA/WebDeveloping/3. Semester/Bachelor/Application/getmoving-fiji/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(396): AppKernel->registerBund
les()
#1 /Users/carante/KEA/WebDeveloping/3. Semester/Bachelor/Application/getmoving-fiji/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(114): Symfony\Component\HttpK
ernel\Kernel->initializeBundles()
#2 /Users/carante/KEA/WebDeveloping/3. Semester/Bachelor/Application/getmoving-fiji/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php(68): Symfony\C
omponent\HttpKernel\Kernel->boot()
#3 /Users/carante/KEA/WebDeveloping/3. Semester/Bachelor/Application/getm in /Users/carante/KEA/WebDeveloping/3. Semester/Bachelor/Application/getmoving-fiji/app/AppKernel.php on l
ine 16
.