snipe-it icon indicating copy to clipboard operation
snipe-it copied to clipboard

PHP Error: Class 'Laravel\Dusk\DuskServiceProvider' not found

Open mafify96 opened this issue 3 years ago • 9 comments

Debug mode

Describe the bug

I am trying to spin the container from the github directory. I cloned it, just changed the port number and ran the docker-compose. I can see an error in the snipeit container as following:

` Error

Class 'Laravel\Dusk\DuskServiceProvider' not found

at vendor/laravel/framework/src/Illuminate/Foundation/Application.php:745 741▕ * @return \Illuminate\Support\ServiceProvider 742▕ / 743▕ public function resolveProvider($provider) 744▕ { ➜ 745▕ return new $provider($this); 746▕ } 747▕ 748▕ /* 749▕ * Mark the given provider as registered.`

Reproduction steps

Unknown

Expected behavior

Should run as I didn't touch the version on the compose

Screenshots

No response

Snipe-IT Version

Latest

Operating System

Ubuntu

Web Server

Apache

PHP Version

the one on snipeit latest

Operating System

No response

Browser

No response

Version

No response

Device

No response

Operating System

No response

Browser

No response

Version

No response

Error messages

No response

Additional context

No response

mafify96 avatar Jan 25 '23 18:01 mafify96

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

welcome[bot] avatar Jan 25 '23 18:01 welcome[bot]

I am having the same issue here

troyygan avatar Jan 26 '23 19:01 troyygan

Had the same issues, error is as follows: [2023-01-26 12:50:41] develop.ERROR: Class 'Laravel\Dusk\DuskServiceProvider' not found {"exception":"[object] (Error(code: 0): Class 'Laravel\Dusk\DuskServiceProvider' not found at /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:745) 
[stacktrace] #0 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(679): Illuminate\Foundation\Application->resolveProvider() #1 /var/www/html/app/Providers/AppServiceProvider.php(82): Illuminate\Foundation\Application->register() #2 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(682): App\Providers\AppServiceProvider->register() #3 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php(75): Illuminate\Foundation\Application->register() #4 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(659): Illuminate\Foundation\ProviderRepository->load() #5 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterProviders.php(17): Illuminate\Foundation\Application->registerConfiguredProviders() #6 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(237): Illuminate\Foundation\Bootstrap\RegisterProviders->bootstrap() #7 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(310): Illuminate\Foundation\Application->bootstrapWith() #8 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(127): Illuminate\Foundation\Console\Kernel->bootstrap() #9 /var/www/html/artisan(35): Illuminate\Foundation\Console\Kernel->handle() #10 {main} "} 

Class 'Laravel\Dusk\DuskServiceProvider' not found at vendor/laravel/framework/src/Illuminate/Foundation/Application.php:745 741▕ * @return \Illuminate\Support\ServiceProvider 742▕ / 743▕ public function resolveProvider($provider) 744▕ { ➜ 745▕ return new $provider($this); 746▕ } 747▕ 748▕ /* 749▕ * Mark the given provider as registered. +1 vendor frames 2 app/Providers/AppServiceProvider.php:82 Illuminate\Foundation\Application::register() +7 vendor frames 10 artisan:35 Illuminate\Foundation\Console\Kernel::handle() chown: /var/www/html/storage/logs/laravel.log: No such file or directory

Possible solution: docker exec snipeit composer dump-autoload -o docker exec snipeit composer require --dev laravel/dusk docker exec snipeit php artisan cache:clear docker exec -it snipeit touch /var/www/html/storage/logs/laravel.log docker exec -it snipeit chown -R apache:apache /var/www/html

It seems that laravel/dusk isn't being pulled in properly (not sure, I am not overly familiar with this), I've fiddled with it all on my side for a bit and it appears to be running now.

d-jorgensen avatar Jan 26 '23 20:01 d-jorgensen

I have the same error on Docker. Solution from @d-jorgensen worked but I had to set group docker:root.

Mistic92 avatar Jan 26 '23 21:01 Mistic92

This more commonly means your APP_ENV is set to something other than production and you ran composer as composer install --no-dev, so the app is trying to load the development test framework but it's not installed because of the --no-dev flag.

snipe avatar Feb 02 '23 20:02 snipe

This more commonly means your APP_ENV is set to something other than production and you ran composer as composer install --no-dev, so the app is trying to load the development test framework but it's not installed because of the --no-dev flag.

Yes, switched APP_ENV=production solves the issue. Thanks!

troyygan avatar Feb 02 '23 23:02 troyygan

This more commonly means your APP_ENV is set to something other than production and you ran composer as composer install --no-dev, so the app is trying to load the development test framework but it's not installed because of the --no-dev flag.

Yes, switched APP_ENV=production solves the issue. Thanks!

How to set or which document to set it? Thank you

netcoler avatar Feb 06 '23 06:02 netcoler

This more commonly means your APP_ENV is set to something other than production and you ran composer as composer install --no-dev, so the app is trying to load the development test framework but it's not installed because of the --no-dev flag.

Yes, switched APP_ENV=production solves the issue. Thanks!

How to set or which document to set it? Thank you

set the key APP_ENV=production in your docker-componse environment file. The default is set to .env.docker

mshauny avatar Apr 05 '23 04:04 mshauny

I ran into this same issue when trying to import location CSVs from the server, docker side. It feels stupid but I learned you can't run php artisan if you're not inside a laravel project folder. If someone else has the same problem, make sure you're in the correct directory path (/var/www/html/snipeit).

Excalibur025 avatar Apr 19 '24 17:04 Excalibur025