Laravel: array_merge(): Argument #2 is not an array error

前端 未结 7 1740
执念已碎
执念已碎 2021-02-07 02:46

Exceptions started to appear in all views, and when I try to run composer update, it always ends up with

{\"error\":{\"type\":\"ErrorException\",\"m         


        
相关标签:
7条回答
  • 2021-02-07 03:16

    Sometimes only deleting app/storage/meta/services.json and run composer update doesn't solve the ERROR: array_merge(): Argument #2 is not an array error. At least in my case, it didn't.

    Most of the time it happens when you're screwing up the bootstrap/cache/services.json file. And running composer update will not generate services.json file.

    To generate the services.json file, you need to delete the previous bootstrap/cache/services.json file and run php artisan serve. Then it'll generate a fresh services.json` file.

    Hope it helps to someone!

    0 讨论(0)
  • 2021-02-07 03:35

    I had similar problem with a fresh install.

    I solved it like this: Removed bootsrap/cache/**services.php** and then i surfed to the website with browser, it generated a new services.php and then it worked.

    0 讨论(0)
  • 2021-02-07 03:38

    Just a composer update worked for me.

    0 讨论(0)
  • 2021-02-07 03:38

    You probably just forgot to put compact('var') as the second return view argument

    return view("path.to.view", compact ('var'))

    0 讨论(0)
  • 2021-02-07 03:42

    After a lot of searching and exploring each file in the 'app' folder, it appears that one file was corrupt

    Delete app/storage/meta/services.json and re-run composer update and this should solve it.

    0 讨论(0)
  • 2021-02-07 03:43
    1. delete bootstrap folder
    2. git reset --hard
    3. composer install
    4. done
    0 讨论(0)
提交回复
热议问题