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

willvincent's avatar

Frankly I think the pre-update-cmd should be moved to post-update-cmd in composer.json.. otherwise every time you add a provider that is not yet in the vendor dir this will happen unless you add the --no-scripts flag, which shouldn't really be necessary.

I believe the default composer.json that ships with laravel should have both of these in post-update-cmd not the clear in pre and optimize in post.. it's unnecessary the way it is now, just troublesome....

Should be:

"scripts": {
  "post-update-cmd": [
    "php artisan clear-compiled",
    "php artisan optimize"
  ],
leobeal's avatar

In my case, using strings without " " in my .env file caused this error in Laravel 5.2.

1 like
dave_ac's avatar

I had this problem. None of the above worked for me. Finally tracked it down to my mistake in the .env file.

DB_USER=dav1d dav1dson

user name should not have a space in it. Doh!

Dotenv values containing spaces must be surrounded by "quotes"

Sayed's avatar

Fix mentioned by rags02 works like a charm !

Thanks.

portchris's avatar

For me, I was installing a package no longer maintained by Laravel:

Package illuminate/html is abandoned, you should avoid using it. Use laravelcollective/html instead.

After I switched to laravelcollective/html and punched in composer update all seemed to work for me.

skeezus's avatar

I received this after after accidentally installing composer in a sub-directory while trying to install a dependency. I obviously caught my error quickly and uninstalled the dependency and removed the composer files but I forgot to remove the vendor directory. After removing the vendor directory I ran composer update and all was good.

KingGeneral's avatar

for me i solve this issue by reload my project with my backup before composer do that lol update version.

with my backup i do change the version in composer.json first, do "composer install" do "composer update"

then its fix, i dont know what kind of magic, may this help.

fizdoonk's avatar

error like this usually caused by syntax error somewhere. try checking .env for eg. not properly quoted value, or running something like phplint on folder like app/ or config/

Ace's avatar

Any solution for this, I got it on 5.4 as well when removing an old package

marcus.nordin's avatar

Using 5.5 I forgot to change the new autoload in the artisan file to:

require DIR.'/vendor/autoload.php';

Note: should also be changed in public/index.php and in phpunit.xml

rajiv's avatar

hmm.. chances are that the app.php providers is not updated. Try updating and running the update command. Chances are that your error should be gone now.

justl00king's avatar

What helped me solve this issue was in AWS, I had to add the ip address of the server to the security group that was attached to the RDS instance. Then just ran composer update and off and running.

abel88's avatar

composer dump-autoload solved my problem

anubhav09's avatar

i had fixed this problem

Removed the bootstrap/cache/services.php file.

composer update.

It's may work for you.

Previous

Please or to participate in this conversation.