13

When runnning composer install on my laravel project I get the error:

Script php artisan clear-compiled handling the post-install-cmd event returned with error code 255

Any advice on what could be the issue? Note composer installs all the vendor packages. The full output is below:

[user@some_path]$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files
> php artisan clear-compiled
Script php artisan clear-compiled handling the post-update-cmd event returned with error code 255

sazr
  • 24,984
  • 66
  • 194
  • 362
  • From all the random "correct" answers, I can deduct that this comes from an error in code, but it may be anywhere in the project. For me, it was on the Exception Handler. I extended a class that was not available. Good luck finding out the source for real problem. – JoeGalind Dec 18 '19 at 20:12

6 Answers6

12

Makse 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

composer dumpautoload
composer update

Try to remove /bootstrap/compiled.php ( if you have it )

Zoltán Jére
  • 604
  • 5
  • 15
2

step 1 - Check your php version. If your laravel is old , then it wont support 7.x, you need to switch (check this if you are using mac) to PHP 5.6 in this case.

Step 2 - remove composer.lock and run composer install

Serjas
  • 2,184
  • 4
  • 21
  • 35
1

The only thing that command does is delete the bootstrap/cache/services.php file, if it exists. Most likely, the file exists, but the permissions aren't set correctly to allow you to delete it.

patricus
  • 59,488
  • 15
  • 143
  • 145
0

i found the solution. Here is list of extensions that causes this problem.

extension=php_pdo_pgsql.dll
extension=php_pdo_sqlite.dll
extension=php_pgsql.dll
extension=php_pdo_mysql.dll

you have to uncomment all of these extensions from your php.ini

E:\wamp64\bin\php\php7.1.9\php.ini

Note :: Must check your database credential into your .env file

Vishal
  • 611
  • 1
  • 8
  • 8
0

I assume the problem can come from multiple sources. In my case, I had a syntax error in my config/app.php. Reverted to a previous version and the remade my edits.

-1

Just run the npm install command from any terminal then re-run composer to install all your dependencies.

ABDO-AR
  • 160
  • 3
  • 9