remote:
remote: In ProviderRepository.php line 208:
remote:
remote: Class 'Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider' not found
remote:
remote:
remote: Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1
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
This is not a ide-helper issue/bug.
Please tread the link provided by Heroku => https://devcenter.heroku.com/articles/php-support , it says
Heroku will not install development dependencies from the require-dev section of composer.json
Very likely, and correctly so, you've installed ide-helper as a dev dependency and thus it's not available in production.
You have multiple options, if you are not using any ide-helper functionality in production:
APP_ENVis not productionrequire instead of require-devThis list is weighted from most preferred to least preferred solution IMHO :-)
I went with a combination of 1 and 2:
In composer.json:
"extra": {
"laravel": {
"dont-discover": [
"barryvdh/laravel-ide-helper"
]
}
},
and then in AppServiceProvider.php:
public function register()
{
if ($this->app->environment() !== 'production') {
$this->app->register(IdeHelperServiceProvider::class);
}
}
UPDATE: In my case this is for docker in a multi stage build. At a later stage I would copy in the Laravel app after having provided vendor and node_modules from an earlier stage. Composer was run with --no-dev but still the helper and thus the error appeared. It turned out that in my local env I had run composer as well so when copying in my app I also included bootstap/cache/* which references the ide helper provider. In that case it didn't matter that I'd added it to 'dont-discover'.
@barryvdh solution was provided, there's nothing this package can do if people manually register and and then don't install dependencies, issue can be closed :}
Had this problem as well, the solution was deleting those cache files right before installing composer dependencies and using artisan cache commands:
- rm ./bootstrap/cache/services.php
- rm ./bootstrap/cache/packages.php
EDIT: You can just use this command:
php artisan optimize:clear
Most helpful comment
This is not a ide-helper issue/bug.
Please tread the link provided by Heroku => https://devcenter.heroku.com/articles/php-support , it says
Very likely, and correctly so, you've installed ide-helper as a dev dependency and thus it's not available in production.
You have multiple options, if you are not using any ide-helper functionality in production:
APP_ENVis not productionrequireinstead ofrequire-devThis list is weighted from most preferred to least preferred solution IMHO :-)