Install Error
laughingpain opened this issue · comments
Alexander Klein commented
> @php artisan package:discover
[LogicException]
You must call one of in() or append() methods before iterating over a Finder.
Script @php artisan package:discover handling the post-autoload-dump event returned with error code 1
Installation failed, reverting ./composer.json to its original content.
fresh laravel 5.5.13 on WAMP with PHP 7.1
mpenna commented
This also happens on a fresh Laravel 5.4.36
mpenna commented
From what I could tell, it has to do with trying to traverse the themes folder during service registration when that folder hasn't yet been created. Changing the singleton registration to the following apparently fixes the issue:
$this->app->singleton('caffeinated.themes', function($app) {
$themes = [];
$items = [];
if ($path = config('themes.paths.absolute')) {
if (file_exists($path) && is_dir($path)) {
$themes = $this->app['files']->directories($path);
}
}
foreach ($themes as $theme) {
$manifest = new Manifest($theme.'/theme.json');
$items[] = $manifest;
}
return new Theme($items);
});