Laravel-modules: How to delete module

Created on 23 Feb 2017  路  10Comments  路  Source: nWidart/laravel-modules

I made new module php artisan module:make sqlqueries
and then rm -rf Modules/sqlqueries

now every artisan command throws

[Illuminate\Contracts\Filesystem\FileNotFoundException] File does not exist at path /module.json

I clear cache but nothing. How to sucessfully delete module:)

Most helpful comment

Just remove all cache files at storage/framework/data/cache/data and artisan command work fine.

All 10 comments

This is the only way to delete a module.

Are you sure there is no mention of it left somewhere ?

Some file is need module.json file from my deletem module. See this :

in Filesystem.php line 41 at Filesystem->get('/module.json') in Json.php line 111 at Json->getContents() in Json.php line 126 at Json->Nwidart\Modules\{closure}() in Repository.php line 288 at Repository->remember('/module.json', 60, object(Closure)) in CacheManager.php line 302 at CacheManager->__call('remember', array('/module.json', 60, object(Closure))) in Json.php line 127 at Json->getAttributes() in Json.php line 40 at Json->__construct('/module.json', object(Filesystem)) in Module.php line 190 at Module->json() in Module.php line 203 at Module->get('active', 0) in Module.php line 293 at Module->isStatus(1) in Repository.php line 204 at Repository->getByStatus(1) in Repository.php line 231 at Repository->enabled() in Repository.php line 263 at Repository->getOrdered() in Repository.php line 295 at Repository->register() in BootstrapServiceProvider.php line 22 at BootstrapServiceProvider->register() in Application.php line 568 at Application->register(object(BootstrapServiceProvider)) in LaravelModulesServiceProvider.php line 35 at LaravelModulesServiceProvider->registerModules() in LaravelModulesServiceProvider.php line 27 at LaravelModulesServiceProvider->boot() at call_user_func_array(array(object(LaravelModulesServiceProvider), 'boot'), array()) in BoundMethod.php line 28 at BoundMethod::Illuminate\Container\{closure}() in helpers.php line 912 at value(object(Closure)) in BoundMethod.php line 86 at BoundMethod::callBoundMethod(object(Application), array(object(LaravelModulesServiceProvider), 'boot'), object(Closure)) in BoundMethod.php line 30 at BoundMethod::call(object(Application), array(object(LaravelModulesServiceProvider), 'boot'), array(), null) in Container.php line 524 at Container->call(array(object(LaravelModulesServiceProvider), 'boot')) in Application.php line 762 at Application->bootProvider(object(LaravelModulesServiceProvider)) in Application.php line 745 at Application->Illuminate\Foundation\{closure}(object(LaravelModulesServiceProvider), 24) at array_walk(array(object(EventServiceProvider), object(LogServiceProvider), object(RoutingServiceProvider), object(AuthServiceProvider), object(CookieServiceProvider), object(DatabaseServiceProvider), object(EncryptionServiceProvider), object(FilesystemServiceProvider), object(FormRequestServiceProvider), object(FoundationServiceProvider), object(NotificationServiceProvider), object(PaginationServiceProvider), object(SessionServiceProvider), object(ViewServiceProvider), object(HtmlServiceProvider), object(ExcelServiceProvider), object(DatatablesServiceProvider), object(ServiceProvider), object(FormBuilderServiceProvider), object(LaratrustServiceProvider), object(EventServiceProvider), object(RepositoryServiceProvider), object(ConsoleServiceProvider), object(ContractsServiceProvider), object(LaravelModulesServiceProvider), object(DuskServiceProvider), object(AppServiceProvider), object(AuthServiceProvider), object(EventServiceProvider), object(RouteServiceProvider), object(MailServiceProvider), object(QueueServiceProvider), object(TranslationServiceProvider), object(CacheServiceProvider)), object(Closure)) in Application.php line 746 at Application->boot() in BootProviders.php line 17 at BootProviders->bootstrap(object(Application)) in Application.php line 208 at Application->bootstrapWith(array('Illuminate\\Foundation\\Bootstrap\\LoadEnvironmentVariables', 'Illuminate\\Foundation\\Bootstrap\\LoadConfiguration', 'Illuminate\\Foundation\\Bootstrap\\HandleExceptions', 'Illuminate\\Foundation\\Bootstrap\\RegisterFacades', 'Illuminate\\Foundation\\Bootstrap\\RegisterProviders', 'Illuminate\\Foundation\\Bootstrap\\BootProviders')) in Kernel.php line 160 at Kernel->bootstrap() in Kernel.php line 144 at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 116 at Kernel->handle(object(Request)) in index.php line 53 at require('/Users/janpisula/Sites/ew2/public/index.php') in server.php line 128

This response is consistent with cache beeing used.
What kind of cache system do you use?

array

Other than cache, as nWidart said, might be mention somewhere, try system-wide search for that module name (case-insensitive)

I had the same problem when deleting a module or making an error in the file module.json.

To solve it in my case for redis I had to do the following:

$ redis-cli
$ DEL key laravel:pingpong-modules
$ DEL key laravel:/**{absoluteModulePath}**/module.json

It seems that everything is produced by the cache generated by the package itself.

Strange that a cache:clear didn't clear these keys though.

Yeah, I have dealt with this numerous times.
Artisan command will not execute since it loads application first and that in turns loads cache from redis, and when you execute cache:clear it will fail with an error since references to non-existing files.
Only way to fix is to wait for cache expires or manually clear cache keys.

I found the following sequence works...

  1. module:disable
  2. cache:clear
  3. now delete module directory
  4. cache:clear - just for good luck

Just remove all cache files at storage/framework/data/cache/data and artisan command work fine.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bhattraideb picture bhattraideb  路  12Comments

elephantux picture elephantux  路  11Comments

esipavicius picture esipavicius  路  13Comments

Alercard picture Alercard  路  29Comments

cristiangervasi picture cristiangervasi  路  12Comments