skip to Main Content

I’m deploying a Laravel application to Heroku for the first time, but I’m getting the following error:

Class "KrloveEloquentModelGeneratorProviderGeneratorServiceProvider" not found

Here’s the full traceback:

remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Building on the Heroku-20 stack
remote: -----> Determining which buildpack to use for this app
remote:  !     Warning: Multiple default buildpacks reported the ability to handle this app. The first buildpack in the list below will be used.
remote:                         Detected buildpacks: PHP,Node.js
remote:                         See https://devcenter.heroku.com/articles/buildpacks#buildpack-detect-order
remote: -----> PHP app detected
remote: -----> Bootstrapping...
remote: -----> Preparing platform package installation...
remote: -----> Installing platform packages...
remote:        - php (8.1.6)
remote:        - apache (2.4.53)
remote:        - composer (2.3.5)
remote:        - nginx (1.20.2)
remote:        NOTICE: detected userland polyfill packages for PHP extensions
remote:        NOTICE: now attempting to install native extension packages
remote:        Installing extensions provided by symfony/polyfill-iconv:
remote:        - ext-iconv (already enabled)
remote:        Installing extensions provided by symfony/polyfill-mbstring:
remote:        - ext-mbstring (bundled with php)
remote:        Installing extensions provided by symfony/polyfill-ctype:
remote:        - ext-ctype (already enabled)
remote: -----> Installing dependencies...
remote:        Composer version 2.3.5 2022-04-13 16:43:00
remote:        Installing dependencies from lock file
remote:        Verifying lock file contents can be installed on current platform.
remote:        Package operations: 70 installs, 0 updates, 0 removals
remote:          - Downloading doctrine/inflector (2.0.4)
remote:          - Downloading doctrine/lexer (1.2.3)
remote:          - Downloading symfony/polyfill-ctype (v1.26.0)
remote:          - Downloading webmozart/assert (1.11.0)
remote:          - Downloading dragonmantank/cron-expression (v3.3.1)
remote:          - Downloading voku/portable-ascii (1.6.1)
remote:          - Downloading symfony/polyfill-php80 (v1.26.0)
remote:          - Downloading symfony/polyfill-mbstring (v1.26.0)
remote:          - Downloading phpoption/phpoption (1.8.1)
remote:          - Downloading graham-campbell/result-type (v1.0.4)
remote:          - Downloading vlucas/phpdotenv (v5.4.1)
remote:          - Downloading symfony/css-selector (v5.4.3)
remote:          - Downloading tijsverkoyen/css-to-inline-styles (2.2.4)
remote:          - Downloading symfony/var-dumper (v5.4.9)
remote:          - Downloading symfony/deprecation-contracts (v2.5.1)
remote:          - Downloading symfony/routing (v5.4.8)
remote:          - Downloading symfony/process (v5.4.8)
remote:          - Downloading symfony/polyfill-php72 (v1.26.0)
remote:          - Downloading symfony/polyfill-intl-normalizer (v1.26.0)
remote:          - Downloading symfony/polyfill-intl-idn (v1.26.0)
remote:          - Downloading symfony/mime (v5.4.9)
remote:          - Downloading symfony/polyfill-php73 (v1.26.0)
remote:          - Downloading symfony/http-foundation (v5.4.9)
remote:          - Downloading psr/event-dispatcher (1.0.0)
remote:          - Downloading symfony/event-dispatcher-contracts (v2.5.1)
remote:          - Downloading symfony/event-dispatcher (v5.4.9)
remote:          - Downloading psr/log (1.1.4)
remote:          - Downloading symfony/error-handler (v5.4.9)
remote:          - Downloading symfony/http-kernel (v5.4.9)
remote:          - Downloading symfony/finder (v5.4.8)
remote:          - Downloading symfony/polyfill-intl-grapheme (v1.26.0)
remote:          - Downloading symfony/string (v5.4.9)
remote:          - Downloading psr/container (1.1.2)
remote:          - Downloading symfony/service-contracts (v2.5.1)
remote:          - Downloading symfony/console (v5.4.9)
remote:          - Downloading symfony/polyfill-iconv (v1.26.0)
remote:          - Downloading egulias/email-validator (2.1.25)
remote:          - Downloading swiftmailer/swiftmailer (v6.3.0)
remote:          - Downloading symfony/polyfill-php81 (v1.26.0)
remote:          - Downloading ramsey/collection (1.2.2)
remote:          - Downloading brick/math (0.9.3)
remote:          - Downloading ramsey/uuid (4.2.3)
remote:          - Downloading psr/simple-cache (1.0.1)
remote:          - Downloading opis/closure (3.6.3)
remote:          - Downloading symfony/translation-contracts (v2.5.1)
remote:          - Downloading symfony/translation (v5.4.9)
remote:          - Downloading nesbot/carbon (2.58.0)
remote:          - Downloading monolog/monolog (2.6.0)
remote:          - Downloading league/mime-type-detection (1.11.0)
remote:          - Downloading league/flysystem (1.1.9)
remote:          - Downloading nette/utils (v3.2.7)
remote:          - Downloading nette/schema (v1.2.2)
remote:          - Downloading dflydev/dot-access-data (v3.0.1)
remote:          - Downloading league/config (v1.1.1)
remote:          - Downloading league/commonmark (2.3.2)
remote:          - Downloading laravel/serializable-closure (v1.2.0)
remote:          - Downloading laravel/framework (v8.83.15)
remote:          - Downloading asm89/stack-cors (v2.1.1)
remote:          - Downloading fruitcake/laravel-cors (v2.2.0)
remote:          - Downloading psr/http-message (1.0.1)
remote:          - Downloading psr/http-client (1.0.1)
remote:          - Downloading ralouphie/getallheaders (3.0.3)
remote:          - Downloading psr/http-factory (1.0.1)
remote:          - Downloading guzzlehttp/psr7 (2.2.1)
remote:          - Downloading guzzlehttp/promises (1.5.1)
remote:          - Downloading guzzlehttp/guzzle (7.4.3)
remote:          - Downloading laravel/sanctum (v2.15.1)
remote:          - Downloading nikic/php-parser (v4.14.0)
remote:          - Downloading psy/psysh (v0.11.5)
remote:          - Downloading laravel/tinker (v2.7.2)
remote:          - Installing doctrine/inflector (2.0.4): Extracting archive
remote:          - Installing doctrine/lexer (1.2.3): Extracting archive
remote:          - Installing symfony/polyfill-ctype (v1.26.0): Extracting archive
remote:          - Installing webmozart/assert (1.11.0): Extracting archive
remote:          - Installing dragonmantank/cron-expression (v3.3.1): Extracting archive
remote:          - Installing voku/portable-ascii (1.6.1): Extracting archive
remote:          - Installing symfony/polyfill-php80 (v1.26.0): Extracting archive
remote:          - Installing symfony/polyfill-mbstring (v1.26.0): Extracting archive
remote:          - Installing phpoption/phpoption (1.8.1): Extracting archive
remote:          - Installing graham-campbell/result-type (v1.0.4): Extracting archive
remote:          - Installing vlucas/phpdotenv (v5.4.1): Extracting archive
remote:          - Installing symfony/css-selector (v5.4.3): Extracting archive
remote:          - Installing tijsverkoyen/css-to-inline-styles (2.2.4): Extracting archive
remote:          - Installing symfony/var-dumper (v5.4.9): Extracting archive
remote:          - Installing symfony/deprecation-contracts (v2.5.1): Extracting archive
remote:          - Installing symfony/routing (v5.4.8): Extracting archive
remote:          - Installing symfony/process (v5.4.8): Extracting archive
remote:          - Installing symfony/polyfill-php72 (v1.26.0): Extracting archive
remote:          - Installing symfony/polyfill-intl-normalizer (v1.26.0): Extracting archive
remote:          - Installing symfony/polyfill-intl-idn (v1.26.0): Extracting archive
remote:          - Installing symfony/mime (v5.4.9): Extracting archive
remote:          - Installing symfony/polyfill-php73 (v1.26.0): Extracting archive
remote:          - Installing symfony/http-foundation (v5.4.9): Extracting archive
remote:          - Installing psr/event-dispatcher (1.0.0): Extracting archive
remote:          - Installing symfony/event-dispatcher-contracts (v2.5.1): Extracting archive
remote:          - Installing symfony/event-dispatcher (v5.4.9): Extracting archive
remote:          - Installing psr/log (1.1.4): Extracting archive
remote:          - Installing symfony/error-handler (v5.4.9): Extracting archive
remote:          - Installing symfony/http-kernel (v5.4.9): Extracting archive
remote:          - Installing symfony/finder (v5.4.8): Extracting archive
remote:          - Installing symfony/polyfill-intl-grapheme (v1.26.0): Extracting archive
remote:          - Installing symfony/string (v5.4.9): Extracting archive
remote:          - Installing psr/container (1.1.2): Extracting archive
remote:          - Installing symfony/service-contracts (v2.5.1): Extracting archive
remote:          - Installing symfony/console (v5.4.9): Extracting archive
remote:          - Installing symfony/polyfill-iconv (v1.26.0): Extracting archive
remote:          - Installing egulias/email-validator (2.1.25): Extracting archive
remote:          - Installing swiftmailer/swiftmailer (v6.3.0): Extracting archive
remote:          - Installing symfony/polyfill-php81 (v1.26.0): Extracting archive
remote:          - Installing ramsey/collection (1.2.2): Extracting archive
remote:          - Installing brick/math (0.9.3): Extracting archive
remote:          - Installing ramsey/uuid (4.2.3): Extracting archive
remote:          - Installing psr/simple-cache (1.0.1): Extracting archive
remote:          - Installing opis/closure (3.6.3): Extracting archive
remote:          - Installing symfony/translation-contracts (v2.5.1): Extracting archive
remote:          - Installing symfony/translation (v5.4.9): Extracting archive
remote:          - Installing nesbot/carbon (2.58.0): Extracting archive
remote:          - Installing monolog/monolog (2.6.0): Extracting archive
remote:          - Installing league/mime-type-detection (1.11.0): Extracting archive
remote:          - Installing league/flysystem (1.1.9): Extracting archive
remote:          - Installing nette/utils (v3.2.7): Extracting archive
remote:          - Installing nette/schema (v1.2.2): Extracting archive
remote:          - Installing dflydev/dot-access-data (v3.0.1): Extracting archive
remote:          - Installing league/config (v1.1.1): Extracting archive
remote:          - Installing league/commonmark (2.3.2): Extracting archive
remote:          - Installing laravel/serializable-closure (v1.2.0): Extracting archive
remote:          - Installing laravel/framework (v8.83.15): Extracting archive
remote:          - Installing asm89/stack-cors (v2.1.1): Extracting archive
remote:          - Installing fruitcake/laravel-cors (v2.2.0): Extracting archive
remote:          - Installing psr/http-message (1.0.1): Extracting archive
remote:          - Installing psr/http-client (1.0.1): Extracting archive
remote:          - Installing ralouphie/getallheaders (3.0.3): Extracting archive
remote:          - Installing psr/http-factory (1.0.1): Extracting archive
remote:          - Installing guzzlehttp/psr7 (2.2.1): Extracting archive
remote:          - Installing guzzlehttp/promises (1.5.1): Extracting archive
remote:          - Installing guzzlehttp/guzzle (7.4.3): Extracting archive
remote:          - Installing laravel/sanctum (v2.15.1): Extracting archive
remote:          - Installing nikic/php-parser (v4.14.0): Extracting archive
remote:          - Installing psy/psysh (v0.11.5): Extracting archive
remote:          - Installing laravel/tinker (v2.7.2): Extracting archive
remote:        Package swiftmailer/swiftmailer is abandoned, you should avoid using it. Use symfony/mailer instead.
remote:        Generating optimized autoload files
remote:        > IlluminateFoundationComposerScripts::postAutoloadDump
remote:        > @php artisan package:discover --ansi
remote:        
remote:        In ProviderRepository.php line 208:
remote:
remote:          Class "KrloveEloquentModelGeneratorProviderGeneratorServiceProvider" not
remote:           found
remote:
remote:
remote:        Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1
remote:  !     WARNING: A post-autoload-dump script terminated with an error
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:  !     - A post-autoload-dump script terminated with an error
remote:
remote:  !     Push rejected, failed to compile PHP app.
remote: 
remote:  !     Push failed
remote:  !
remote:  ! ## Warning - The same version of this code has already been built: d5f7445d661a72d0cf06e74669a8291e7f9dfe15
remote:  !
remote:  ! We have detected that you have triggered a build from source code with version d5f7445d661a72d0cf06e74669a8291e7f9dfe15
remote:  ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch.
remote:  !
remote:  ! If you are developing on a branch and deploying via git you must run:
remote:  !
remote:  !     git push heroku <branchname>:main
remote:  !
remote:  ! This article goes into details on the behavior:
remote:  !   https://devcenter.heroku.com/articles/duplicate-build-version
remote:
remote: Verifying deploy...
remote: 
remote: !       Push rejected to laravel-phone-book.
remote:
To https://git.heroku.com/laravel-phone-book.git
 ! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/laravel-phone-book.git'

Here’s my composer.json:

    "require": {
        "php": "^7.3|^8.0",
        "fruitcake/laravel-cors": "^2.0",
        "guzzlehttp/guzzle": "^7.0.1",
        "krlove/eloquent-model-generator": "^1.3",
        "laravel/framework": "^8.75",
        "laravel/sanctum": "^2.11",
        "laravel/tinker": "^2.5"
    },
    "require-dev": {
        "facade/ignition": "^2.5",
        "fakerphp/faker": "^1.9.1",
        "laravel/sail": "^1.0.1",
        "laravel/ui": "^3.4",
        "mockery/mockery": "^1.4.4",
        "nunomaduro/collision": "^5.10",
        "phpunit/phpunit": "^9.5.10",
        "reliese/laravel": "^1.1"
    }

Things I’ve tried:

Changing the package to production enviroment by running the following command (whereas before I added the --dev tag to the end of the command):

composer require krlove/eloquent-model-generator

Deleting all the files within bootstrap/cache folder.

Running php artisan config:clear

Running composer dumpautoload

Deleting the vendor folder ands running composer install again

What am I doing wrong and how can I fix it?

Thank you

2

Answers


  1. You haves installed a package that is thought to be a helper in development as a production dependency.

    My advice use latest version of the package and follow instructions on how to install it as a dev dependency.

    composer require krlove/eloquent-model-generator --dev
    
    

    And finally check your config/app.php and look for

    'providers' => [
    ...
    KrloveEloquentModelGeneratorProviderGeneratorServiceProvider::class,
    
    ];
    

    And comment it out.

    after that run

     artisan optimize:clear  && composer dumpautoload && artisan optimize
    

    Hope this help

    Login or Signup to reply.
  2. Add the line below in config/app.php inside ‘providers’ array

    KrloveEloquentModelGeneratorProviderGeneratorServiceProvider::class,
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search