skip to Main Content

My application developed with Symfony 4 in the backend and React js in the frontend, then I want to deploy it on Heroku. I have already connected heroku with my github repository. Finally after I configured everything, I launched the command git push heroku master, then I found the following error shown below:

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 FOSRestBundleExamplesRssHandler 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 'SymfonyBundleTwigBundleTwigBundle' 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): AppKernel->registerBundles()
remote:        !!  #1 /tmp/build_cf339a6abd921797e6f08d60cb51e78d/vendor/symfony/http-kernel/Kernel.php(130): SymfonyComponentHttpKernelKernel->initializeBundles()
remote:        !!  #2 /tmp/build_cf339a6abd921797e6f08d60cb51e78d/vendor/symfony/framework-bundle/Console/Application.php(159): SymfonyComponentHttpKernelKernel->boot()
remote:        !!  #3 /tmp/build_cf339a6abd921797e6f08d60cb51e78d/vendor/symfony/framework-bundle/Console/Application.php(65): SymfonyBundleFrameworkBundleConsoleApplication->registerCommands()
remote:        !!  #4 /tmp/build_cf339a6abd921797e6f08d60cb51e78d/vendor/symfony/console/Application.php(149): SymfonyBundleFrameworkBundleConsoleApplication->doRun()
remote:        !!  #5 /tmp/build_cf339a6abd921797e6f08d60cb51e78d/bin/console(42): SymfonyComponentConsoleApplication->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'

Can anyone give me any solution or suggestion? Thanks

2

Answers


  1. It looks like you have enabled TwigBundle in your bundles config, but it’s not set in your composer.json file for some reason.
    Try to reinstall twig pack:

    composer req twig
    

    or remove TwigBundle from config/bundles.php if you don’t need it.

    Login or Signup to reply.
  2. This problem is possibly due to @auto-scripts being enabled in post-install-cmd in composer.json . You need to remove it, and it may work fine. i.e. Your composer.json will look as:

    "post-install-cmd": [
    
    ],
    "post-update-cmd": [
        "@auto-scripts"
    ]
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search