laravel-modules: [Module] Service provider not found on production server
I created Employee Module, but error message is appearing on production server like that
[Symfony\Component\Debug\Exception\FatalThrowableError]
Class 'Modules\Employee\Providers\EmployeeServiceProvider' not found
Development -> Mac Production -> Ubuntu server 14.04, Nginx
I also run a composer dump-autoload
and php artisan clear-compiled
on production.
Application is running stable on development server. I don’t exactly know this error message. Please help me. Thanks
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 18 (5 by maintainers)
have a look at app/config/modules.php
in line ~65 , change
'modules' => base_path('Modules'),
to'modules' => base_path('modules'),
this solved the problem for us ( coming from named routes not working) I am not sure if the different naming is general bug, so if you run php artisan module: make test it will create a ‘Modues’ dir, even if ‘modules’ is present
@KyawNaingTun i run several apps using this package on Ubuntu and i comply with PSR4 naming and had no issues. Folder name
Modules
namespaceModules
and everything good.And also
composer.json
have correct information :Hello @ederrafo , Please have a look the following steps
1. Folder structure-
2. and then check in your composer.json
3. run this command
composer dump-autoload
But this still suggests me that it’s not a legit fix. You just somewhere have lowercase modules in your namespace. The uppercase Modules is correct. Almost as if your modules would not be namespaced under Modules root but excluding that.
But i’m glad it worked out for you 😃
As @nWidart pointed out: make sure that file location on production server is exactly
Modules/Employee/Providers/EmployeeServiceProvider.php
matching all lower and upper case letters. It is a common problem when people develop using Windows (Mac also by default) (which ignore upper case in file name), everything works fine and when they upload to production (which is usually unix based system that does not ignore upper case in file name) they see file not found errors.Mine only works when I rename the modules folder to Modules
I solved all errors. 😄 Thank everybody Solutions:
Modules
tomodules
Hello,
If you’re having this on production and not locally it’s quite possible it’s a Case sensitive issue.
Double check what casings the files have.