22

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}}

10 Answers 10

38
+50

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.

Sign up to request clarification or add additional context in comments.

9 Comments

Just going to add same problem though service.json was in bootstrap/cache/
This is such a cryptic issue, hopefully others find this answer if (when) they have this symptom with Laravel.
Can't run composer update because of the error. (array_merge(): Argument #2 is not an array)
>>php artisan cache:clear >>php artisan config:cache >>composer update
This happened for me by having an empty config.php file
|
7

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!

4 Comments

So what about when php artisan serve gives me the same error? (array_merge(): Argument #2 is not an array)
You've to delete the bootstrap/cache/services.json file first. Then try php artisan serve.
I don't remember what I did but it's working now. I think I made a JSON object in services.json with one property with the key "providers" or something. Although Gulp still isn't versioning my files. Thanks for helping!
I've checked with my project not available services.json in bootstrap/cache
3

I had a similar problem with a fresh install.

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

Comments

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

2 Comments

Thanks fico7489, I cannot say whether this the best workaround but it certainly worked for me. Thanks for the solution.
Mine is not fixed, after using this also, and all the other answers any idea or any other options?
0

Just a composer update worked for me.

Comments

0

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

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

Comments

0

I was facing this issue, and my problem was the version of "pusher/pusher-php-server" in composer.json was not matching with my laravel version. For this reason composer-update and deleting caches were not working for me.

I thought maybe this information could help someone.

Comments

0

I got the same error - "array_merge(): Argument #2 is not an array error". running "composer dump-autoload" followed by npm run dev solved the problem immediately. No need of updating composer, npm etc.

Comments

0

in my case app/storage/meta/services.json was empty for some reasson

Comments

0

I deleted the bootstrap/cache/services.json and ran composer update after that it worked for me

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.