Home > other >  Laravel 8 - Windows - package discover post-autoload-dump event returned with error code 255
Laravel 8 - Windows - package discover post-autoload-dump event returned with error code 255

Time:11-12

I just created a Laravel project in my windows with this command :

composer create-project --prefer-dist laravel/laravel test-windows "8.*"

But I got some errors about requirements missing during the installation of dependencies :

  Problem 1
- laravel/framework[v8.65.0, ..., 8.x-dev] require league/flysystem ^1.1 -> satisfiable by league/flysystem[1.1.0, ..., 1.x-dev].
- league/flysystem[1.1.0, ..., 1.x-dev] require ext-fileinfo * -> it is missing from your system. Install or enable PHP's fileinfo extension.
- Root composer.json requires laravel/framework ^8.65 -> satisfiable by laravel/framework[v8.65.0, ..., 8.x-dev].

To enable extensions, verify that they are enabled in your .ini files:
- C:\Program Files\PHP\v7.4\php.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

So I tried :

composer install --ignore-platform-reqs

So all dependencies are now installed successfully but in the end, I have another problem :

82 package suggestions were added by new dependencies, use `composer suggest` to see details.
Generating optimized autoload files
Illuminate\Foundation\ComposerScripts::postAutoloadDump
@php artisan package:discover --ansi
Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 255

And now I can't start the project or do anything else. I'm stuck, I found a lot of things for Laravel 6 or 7 but I'm currently using Laravel 8.

Anyone can help me ?

My environment :

  • OS: Windows 10
  • Composer: version 2.0.8
  • PHP: version 7.4.1
  • Laravel (in composer.json): version ^8.65

EDIT: @apokryfos advice me to install ext-fileinfo in my php.ini. So I tried to find a way to do this, but when I'm trying to edit the php.ini file and save it, I got an error by Windows "You don't have the autorisation to do this". I'll try to reinstall PHP because I have PHP v7.4 and it's normally installed by default starting with PHP 5.3.0. So I think my PHP has a problem in local in my computer.

EDIT 2: I tried to reinstall PHP v7.4 but it doesn't change anything.

CodePudding user response:

I found how to edit my php.ini in my Windows as administrator, following this link :

  1. Press the Windows logo (bottom left)
  2. Type Notepad in the search field
  3. Click right on the Notepad and select Run as administrator
  4. From Notepad, click on File > Open and paste C:\Program Files\PHP\v7.4\php.ini
  5. I added the line extension=php_fileinfo.dll
  6. Save

Now, all works fine and I can use composer install

  • Related