'Class 'NunoMaduro\Collision\Adapters\Laravel\CollisionServiceProvider' not found

When trying to install composer in laravel project get this error.

Illuminate\Foundation\ComposerScripts::postAutoloadDump @php artisan package:discover In ProviderRepository.php line 208:

Class 'NunoMaduro\Collision\Adapters\Laravel\CollisionServiceProvider' not
found
Script @php artisan package:discover handling the post-autoload-dump event returned with error code 1



Solution 1:[1]

I had this issue when deploying my app to Google App Engine. I found that by moving "nunomaduro/collision": "^2.0" from "require-dev" to "require" in my composer.json fixed this problem.

Solution 2:[2]

  • move nunomaduro/collision: ^2.0 from require-dev to require in composer

If that doesn't solve the problem, try

  • deleting the composer.lock file
  • uploading the project again without this file (it solved it for me)

Solution 3:[3]

If your project is not running on production, set the APP_ENV to dev or something different than production. The migration and seeds should work.

Solution 4:[4]

Inside of your composer.lock ,

Move "nunomaduro/larastan": "^0.3.0", to "require" from "require-dev" .

then run composer install

this worked for me

Solution 5:[5]

in php v-8 i get this error " Call to undefined method Dotenv\Repository\RepositoryBuilder::create()" and then in terminall type this "composer outdated" and then i know i should update nunomaduro/collision then in terminal "composer require nunomaduro/collision"

Solution 6:[6]

I am using 5.6 version with php version 7.2

Tried these page solutions

but following worked for me

in terminal

  1. composer outdated
  2. composer require nunomaduro/collision:^3.0 --dev

Note: I have no Idea if the first step is must but I wrote that command in terminal, Try using 2nd only, if it works then suggest me to edit please.

Thank you.

I found this solution from Git Hub page Github

Solution 7:[7]

In your case the problem was that after running composer install --no-dev, php artisan package:discover is run automatically.

Whenever php artisan command fails, it tries to use the class NunoMaduro\Collision\Adapters\Laravel\CollisionServiceProvider for error handline which is only installed when laravel development packages are used. As you can see in this composer.json, collision is in the require-dev group.

    "require-dev": {
        "nunomaduro/collision": "^6.1",
    },

The problem can be solved by:

  • moving the dependency to the require section
  • or figuring out what causes the artisan command error.

In my case, it was either outdated php files or permission issues in the bootstrap/cache directory.

Solution 8:[8]

I have answer in folder boostrap/cache/packages.php , we will succes .So delete package is error.

Class 'NunoMaduro\Collision\Adapters\Laravel\CollisionServiceProvider' not found

Deleting...

So you PHP artisan serve.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mark Wright
Solution 2 Stephen Ostermiller
Solution 3 DontVoteMeDown
Solution 4 Ethan Borkosky
Solution 5 azi.mohammadi
Solution 6 Hemant Maurya
Solution 7 8ctopus
Solution 8 tawab_shakeel