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

依然范特西╮ 提交于 2020-01-01 01:16:14

问题


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

{"error":{"type":"ErrorException","message":"array_merge(): Argument #2 is not an array","file":"\/laravel\/framework\/src\/Illuminate\/Foundation\/ProviderRepository.php","line":188}}

回答1:


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.




回答2:


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!




回答3:


  1. delete bootstrap folder
  2. git reset --hard
  3. composer install
  4. done



回答4:


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.




回答5:


I solved it:

open This folder-->/Applications/MAMP/htdocs/*****/vendor/laravel/framework/src/Illuminate/View/Factory.php

and comment this line

//$data = array_merge($mergeData, $this->parseData($data));

line number -> 136.




回答6:


Just a composer update worked for me.



来源:https://stackoverflow.com/questions/25575217/laravel-array-merge-argument-2-is-not-an-array-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!