Currently while I am trying to update the dependencies of my project, I got hit with the issue that the build process fail due to the error: Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 255
.
This error occurs only when I try to update the sentry/laravel 1.5.0 package to the version 1.6.1. I do not have the issue with other dependencies. I have tried to do the same as in Script @php artisan package:discover handling the post-autoload-dump event returned with error code 255 but none of solutions helped me.
Full response:
#!/bin/bash -eo pipefail
composer install -n --prefer-dist --ignore-platform-reqs
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Package zendframework/zend-diactoros is abandoned, you should avoid using it. Use
laminas/laminas-diactoros instead.
Generating optimized autoload files
> IlluminateFoundationComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
Script @php artisan package:discover --ansi handling the post-autoload-dump event returned
with error code 255
Exited with code exit status 255
Of course I could keep using the version 1.5.0 but I prefer having my dependencies up to date. Is there something I maybe miss?
Thank you in advance for help.
2
Answers
Make sure your
storage/
&bootstrap/cache
directory writeable.Make sure your
.env
file doesent contain any spaces.Ex: key=value istead of key=va lue
remove the bootstrap/cache/config.php file. then
Try to remove
/bootstrap/compiled.php
( if you have it )I know this is a few months old, but I just had the same error and wanted to share what caused it for me in case someone else ran into this issue.
I had installed Laravel Telescope to help with development. When I removed it, the TelescopeServiceProvider didn’t get removed from the providers array in config/app.php during the composer update (probably due to something I did).
Laravel’s package:discover command tripped up on having the service provider in the config when the package was not installed.
So, in summary, check to make sure you don’t have any service providers in the providers array of the app config for packages that are no longer installed.