I got this error while running setup:di:compile and tried this, but in my case the module is required. Such directory does exists and isn't empty, but if I delete the files contained there, di:compile runs smoothly...
How to fix this without deleting the module files?
In DirectoryScanner.php line 24:
RecursiveDirectoryIterator::__construct(/var/www/html/vendor/modo/paga-con-modo/Controller/adminhtml): Failed to open directory: No such file or directory
setup:di:compile