Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

DarHa1531212's avatar

Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1 when running composer install

Hi, I'm a bit of a newbie to PHP in general and the common solutions such as running composer update and other stack overflow suggestions didn't work. Here is the complete error message when I try to run composer update

> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

In Finder.php line 640:

  The "" directory does not exist.  


Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1
0 likes
1 reply
Zoog's avatar

Edit: After several tests, simply deleting the composer.json and then running composer install seems to be a solution.

I haven't found the exact reason, but it appears that when using Git and the 'vendor' directory is in the .gitignore, executing composer install again can lead to problems. Typically, removing the 'vendor' and 'node_modules' directories, as well as the package.json and composer.json files, followed by running composer install and npm install should resolve the issue. Subsequently, based on your application, execute npm run dev followed by npm run build. If this doesn't rectify the problem, attempt to locate an older version of your 'vendor' directory and copy it into your project.

Please or to participate in this conversation.