在Heroku上使用React js应用程序部署Symfony 4

问题描述 投票:0回答:1

我的应用程序在后端使用Symfony 4开发,在前端使用React js开发,然后我希望将其部署在Heroku上。我已经将heroku与我的github存储库连接了。最后,在完成所有配置后,我启动了命令git push heroku master,然后发现以下错误:

git push heroku master
Enumerating objects: 255, done.
Counting objects: 100% (255/255), done.
Delta compression using up to 4 threads
Compressing objects: 100% (250/250), done.
Writing objects: 100% (255/255), 159.41 KiB | 2.61 MiB/s, done.
Total 255 (delta 144), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> PHP app detected
remote: -----> Bootstrapping...
remote: -----> Installing platform packages...
remote:        - php (7.4.4)
remote:        - ext-gd (bundled with php)
remote:        - ext-mbstring (bundled with php)
remote:        - apache (2.4.41)
remote:        - nginx (1.16.1)
remote: -----> Installing dependencies...
remote:        Composer version 1.10.1 2020-03-13 20:34:27
remote:        Loading composer repositories with package information
remote:        Installing dependencies from lock file
remote:        Package operations: 91 installs, 0 updates, 0 removals
remote:          - Installing ocramius/package-versions (1.4.2): Downloading (100%)
remote:          - Installing symfony/flex (v1.6.0): Downloading (100%)
remote:
remote:        Prefetching 89 packages
remote:          - Downloading (100%)
remote:
remote:          - Installing doctrine/lexer (1.2.0): Loading from cache
remote:          - Installing doctrine/annotations (v1.8.0): Loading from cache
remote:          - Installing doctrine/reflection (v1.0.0): Loading from cache
remote:          - Installing doctrine/event-manager (1.1.0): Loading from cache
remote:          - Installing doctrine/collections (1.6.4): Loading from cache
remote:          - Installing doctrine/cache (1.10.0): Loading from cache
remote:          - Installing doctrine/persistence (1.3.3): Loading from cache
remote:          - Installing doctrine/inflector (1.3.1): Loading from cache
remote:          - Installing doctrine/common (v2.11.0): Loading from cache
remote:          - Installing doctrine/instantiator (1.3.0): Loading from cache
remote:          - Installing psr/container (1.0.0): Loading from cache
remote:          - Installing symfony/service-contracts (v1.1.8): Loading from cache
remote:          - Installing symfony/stopwatch (v4.3.9): Loading from cache
remote:          - Installing symfony/polyfill-php73 (v1.13.1): Loading from cache
remote:          - Installing symfony/polyfill-mbstring (v1.13.1): Loading from cache
remote:          - Installing symfony/console (v4.3.9): Loading from cache
remote:          - Installing zendframework/zend-eventmanager (3.2.1): Loading from cache
remote:          - Installing zendframework/zend-code (3.4.1): Loading from cache
remote:          - Installing ocramius/proxy-manager (2.2.3): Loading from cache
remote:          - Installing doctrine/dbal (v2.10.0): Loading from cache
remote:          - Installing doctrine/migrations (2.2.0): Loading from cache
remote:          - Installing willdurand/negotiation (v2.3.1): Loading from cache
remote:          - Installing willdurand/jsonp-callback-validator (v1.1.0): Loading from cache
remote:          - Installing symfony/event-dispatcher-contracts (v1.1.7): Loading from cache
remote:          - Installing symfony/security-core (v4.3.9): Loading from cache
remote:          - Installing symfony/routing (v4.3.9): Loading from cache
remote:          - Installing symfony/polyfill-php72 (v1.13.1): Loading from cache
remote:          - Installing symfony/polyfill-intl-idn (v1.13.1): Loading from cache
remote:          - Installing symfony/mime (v4.3.9): Loading from cache
remote:          - Installing symfony/http-foundation (v4.3.9): Loading from cache
remote:          - Installing symfony/event-dispatcher (v4.3.9): Loading from cache
remote:          - Installing psr/log (1.1.2): Loading from cache
remote:          - Installing symfony/debug (v4.3.9): Loading from cache
remote:          - Installing symfony/http-kernel (v4.3.9): Loading from cache
remote:          - Installing symfony/finder (v4.3.9): Loading from cache
remote:          - Installing symfony/filesystem (v4.3.9): Loading from cache
remote:          - Installing symfony/dependency-injection (v4.3.9): Loading from cache
remote:          - Installing symfony/config (v4.3.9): Loading from cache
remote:          - Installing symfony/var-exporter (v4.3.9): Loading from cache
remote:          - Installing psr/cache (1.0.1): Loading from cache
remote:          - Installing symfony/cache-contracts (v1.1.7): Loading from cache
remote:          - Installing symfony/cache (v4.3.9): Loading from cache
remote:          - Installing symfony/framework-bundle (v4.3.9): Loading from cache
remote:          - Installing friendsofsymfony/rest-bundle (2.6.0): Loading from cache
remote:          - Installing jdorn/sql-formatter (v1.2.17): Loading from cache
remote:          - Installing symfony/inflector (v4.3.9): Loading from cache
remote:          - Installing symfony/property-access (v4.3.9): Loading from cache
remote:          - Installing symfony/security-http (v4.3.9): Loading from cache
remote:          - Installing symfony/security-guard (v4.3.9): Loading from cache
remote:          - Installing symfony/security-csrf (v4.3.9): Loading from cache
remote:          - Installing symfony/security-bundle (v4.3.9): Loading from cache
remote:          - Installing namshi/jose (7.2.3): Loading from cache
remote:          - Installing lcobucci/jwt (3.3.1): Loading from cache
remote:          - Installing lexik/jwt-authentication-bundle (v2.6.5): Loading from cache
remote:          - Installing nelmio/cors-bundle (2.0.1): Loading from cache
remote:          - Installing phpdocumentor/reflection-common (2.0.0): Loading from cache
remote:          - Installing phpdocumentor/type-resolver (1.0.1): Loading from cache
remote:          - Installing psr/simple-cache (1.0.1): Loading from cache
remote:          - Installing markbaker/matrix (1.2.0): Loading from cache
remote:          - Installing markbaker/complex (1.4.7): Loading from cache
remote:          - Installing phpoffice/phpspreadsheet (1.10.1): Loading from cache
remote:          - Installing sensio/framework-extra-bundle (v5.5.2): Loading from cache
remote:          - Installing symfony/apache-pack (v1.0.1): Loading from cache
remote:          - Installing symfony/doctrine-bridge (v4.3.9): Loading from cache
remote:          - Installing symfony/dotenv (v4.3.9): Loading from cache
remote:          - Installing symfony/options-resolver (v4.3.9): Loading from cache
remote:          - Installing symfony/intl (v4.3.9): Loading from cache
remote:          - Installing symfony/polyfill-intl-icu (v1.13.1): Loading from cache
remote:          - Installing symfony/form (v4.3.9): Loading from cache
remote:          - Installing egulias/email-validator (2.1.15): Loading from cache
remote:          - Installing symfony/mailer (v4.3.10): Loading from cache
remote:          - Installing symfony/google-mailer (v4.3.11): Loading from cache
remote:          - Installing nikic/php-parser (v4.3.0): Loading from cache
remote:          - Installing symfony/maker-bundle (v1.14.3): Loading from cache
remote:          - Installing monolog/monolog (1.25.2): Loading from cache
remote:          - Installing symfony/monolog-bridge (v4.3.9): Loading from cache
remote:          - Installing symfony/monolog-bundle (v3.5.0): Loading from cache
remote:          - Installing doctrine/orm (v2.7.0): Loading from cache
remote:          - Installing doctrine/doctrine-bundle (2.0.2): Loading from cache
remote:          - Installing doctrine/doctrine-migrations-bundle (2.1.2): Loading from cache
remote:          - Installing symfony/orm-pack (v1.0.7): Loading from cache
remote:          - Installing symfony/serializer (v4.3.9): Loading from cache
remote:          - Installing symfony/property-info (v4.3.9): Loading from cache
remote:          - Installing webmozart/assert (1.6.0): Loading from cache
remote:          - Installing phpdocumentor/reflection-docblock (4.3.2): Loading from cache
remote:          - Installing symfony/serializer-pack (v1.0.2): Loading from cache
remote:          - Installing symfony/translation-contracts (v1.1.7): Loading from cache
remote:          - Installing symfony/validator (v4.3.9): Loading from cache
remote:          - Installing symfony/yaml (v4.3.9): Loading from cache
remote:        Package zendframework/zend-eventmanager is abandoned, you should avoid using it. Use laminas/laminas-eventmanager instead.
remote:        Package zendframework/zend-code is abandoned, you should avoid using it. Use laminas/laminas-code instead.
remote:        Generating optimized autoload files
remote:        Deprecation Notice: Class FOS\RestBundle\Examples\RssHandler located in ./vendor/friendsofsymfony/rest-bundle/Resources/doc/examples/RssHandler.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///tmp/build_cf339a6abd921797e6f08d60cb51e78d/.heroku/php/bin/composer/src/Composer/Autoload/ClassMapGenerator.php:201
remote:        ocramius/package-versions:  Generating version class...
remote:        ocramius/package-versions: ...done generating version class
remote:        Executing script cache:clear [KO]
remote:         [KO]
remote:        Script cache:clear returned with error code 255
remote:        !!  PHP Fatal error:  Uncaught Error: Class 'Symfony\Bundle\TwigBundle\TwigBundle' not found in /tmp/build_cf339a6abd921797e6f08d60cb51e78d/src/Kernel.php:23
remote:        !!  Stack trace:
remote:        !!  #0 /tmp/build_cf339a6abd921797e6f08d60cb51e78d/vendor/symfony/http-kernel/Kernel.php(429): App\Kernel->registerBundles()
remote:        !!  #1 /tmp/build_cf339a6abd921797e6f08d60cb51e78d/vendor/symfony/http-kernel/Kernel.php(130): Symfony\Component\HttpKernel\Kernel->initializeBundles()
remote:        !!  #2 /tmp/build_cf339a6abd921797e6f08d60cb51e78d/vendor/symfony/framework-bundle/Console/Application.php(159): Symfony\Component\HttpKernel\Kernel->boot()
remote:        !!  #3 /tmp/build_cf339a6abd921797e6f08d60cb51e78d/vendor/symfony/framework-bundle/Console/Application.php(65): Symfony\Bundle\FrameworkBundle\Console\Application->registerCommands()
remote:        !!  #4 /tmp/build_cf339a6abd921797e6f08d60cb51e78d/vendor/symfony/console/Application.php(149): Symfony\Bundle\FrameworkBundle\Console\Application->doRun()
remote:        !!  #5 /tmp/build_cf339a6abd921797e6f08d60cb51e78d/bin/console(42): Symfony\Component\Console\Application->run()
remote:        !!  #6 {main}
remote:        !!    t in /tmp/build_cf339a6abd921797e6f08d60cb51e78d/src/Kernel.php on line 23
remote:        !!
remote:        Script @auto-scripts was called via post-install-cmd
remote:  !     WARNING: There was a class not found error in your code
remote:
remote:  !     ERROR: Dependency installation failed!
remote:  !
remote:  !     The 'composer install' process failed with an error. The cause
remote:  !     may be the download or installation of packages, or a pre- or
remote:  !     post-install hook (e.g. a 'post-install-cmd' item in 'scripts')
remote:  !     in your 'composer.json'.
remote:  !
remote:  !     Typical error cases are out-of-date or missing parts of code,
remote:  !     timeouts when making external connections, or memory limits.
remote:  !
remote:  !     Check the above error output closely to determine the cause of
remote:  !     the problem, ensure the code you're pushing is functioning
remote:  !     properly, and that all local changes are committed correctly.
remote:  !
remote:  !     For more information on builds for PHP on Heroku, refer to
remote:  !     https://devcenter.heroku.com/articles/php-support
remote:  !
remote:  !     REMINDER: the following warnings were emitted during the build;
remote:  !     check the details above, as they may be related to this error:
remote:  !     - There was a class not found error in your code
remote:
remote:  !     Push rejected, failed to compile PHP app.
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:
remote: !       Push rejected to agro-interest.
remote:
To https://git.heroku.com/agro-interest.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/show-agro-interest.git'

有人可以给我任何解决方案或建议吗?谢谢

php reactjs heroku symfony4
1个回答
0
投票

似乎您已在bundles配置中启用了TwigBundle,但由于某种原因未在composer.json文件中进行设置。尝试重新安装树枝包:

composer req twig

或如果不需要,请从config/bundles.php中删除TwigBundle。

© www.soinside.com 2019 - 2024. All rights reserved.