Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

wallyWarthog's avatar

Pls Help! My php artisan command has just stopped working. I get a "[RuntimeException] Directory name must not be empty" error

Hi all

I was happily following along one of the Laracasts episodes and suddenly my php artisan command stopped working. I just get "[RuntimeException] Directory name must not be empty"

I have googled this problem and nothing seems to help. The most common answer is to update my composer and then run php artisan config:cache but this misses the whole point as I am UNABLE to run php artisan at all, even after I update my composer.

What do I do? I would like to understand why its saying my Directory Name is empty? What Directory is this talking about?

Thanks for your help in advance.

0 likes
10 replies
Dry7's avatar

You can copy the content /storage/log.txt ?

bipin's avatar

did you check your path of cmd is same as project folder for eg:-

   C:\xampp\htdocs\yourproject>

or E:\yourproject> just give path where you have your project

wallyWarthog's avatar

Hey guys. Yes I am in my current project folder. I also have the artisan file in my projects directory. I have just created a desktop folder with my project folder inside. It doesn't have to be within the xampp directory does it? (my location is c:\users\my_name\Desktop\Test\Project)

Like I said, it was working fine and then suddenly stopped working. I was watching the Laravel tutorial and created my own custom Model called Task. After this, everything just stopped working.

FYI: If I open another Laravel project (in another directory) then php artisan works fine ... but i am worried that it can just stop working like this out of the blue.

Any suggestions?

AddWebContribution's avatar

And what if you remove your own custom Model, if it again works fine the check that code having used realpath(__DIR__)?

If used then check print __DIR__;, may be this is the cause if you used as I described.

Penaf's avatar

This happened to me today also. Can anyone help me ?

Exactly as described, I was also creating a custom model of a database table that already existed.

The model I created was JB_Multimedia.php (code below) the next thing I get this Fatal error: ( ! ) Fatal error: Uncaught ReflectionException: Class view does not exist in /home/vagrant/Code/ecocampus/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 752 ( ! ) ReflectionException: Class view does not exist in /home/vagrant/Code/ecocampus/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 752

Now "php artisan" commands don't work and I already did a composer update.

Logs are of no help... just plenty of this:

[2018-05-22 21:15:30] production.ERROR: The "" directory does not exist. {"exception":"[object] (InvalidArgumentException(code: 0): The \"\" directory does not exist. at /home/vagrant/Code/myProject/vendor/symfony/finder/Finder.php:547)

Model: JB.Multimedia.php

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class JB_Multimedia extends Model
{

    protected $table = 'JB_Multimedia';

    protected $primaryKey = 'idMultimedia';

    protected $guarded = ['idMultimedia'];

    public $timestamps = false;

}
Snapey's avatar

you should be able to look at the whole stack trace for the error in the logfile and see if it shows any of your code

Penaf's avatar

Thanks for the reply @Snapey. The thing is that the laravel.log doesn't provide much info to me. Just about a hundred of this:

[2018-05-22 23:22:25] production.ERROR: The "" directory does not exist. {"exception":"[object] (InvalidArgumentException(code: 0): The \"\" directory does not exist. at /home/vagrant/Code/ecocampus/vendor/symfony/finder/Finder.php:547)
[stacktrace]
#0 /home/vagrant/Code/ecocampus/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php(87): Symfony\Component\Finder\Finder->in(false)
#1 /home/vagrant/Code/ecocampus/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php(64): Illuminate\Foundation\Bootstrap\LoadConfiguration->getConfigurationFiles(Object(Illuminate\Foundation\Application))
#2 /home/vagrant/Code/ecocampus/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php(39): Illuminate\Foundation\Bootstrap\LoadConfiguration->loadConfigurationFiles(Object(Illuminate\Foundation\Application), Object(Illuminate\Config\Repository))
#3 /home/vagrant/Code/ecocampus/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(213): Illuminate\Foundation\Bootstrap\LoadConfiguration->bootstrap(Object(Illuminate\Foundation\Application))
#4 /home/vagrant/Code/ecocampus/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(162): Illuminate\Foundation\Application->bootstrapWith(Array)
#5 /home/vagrant/Code/ecocampus/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(146): Illuminate\Foundation\Http\Kernel->bootstrap()
#6 /home/vagrant/Code/ecocampus/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(116): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#7 /home/vagrant/Code/ecocampus/public/index.php(55): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#8 {main}
"} 

Snapey's avatar

Thanks pretty early in the bootstrap process @Penaf

Have you changed the name of the app or something like that

Are you running php artisan from the root of the project?

Check the structure of your config folder

Penaf's avatar

@Snapey If you say it's pretty early on the bootstrap process ... I trust you :) this is my first big project using laravel.

I haven't change the name of the app. I was making a custom modl and the name colided with a Helper class I had created earlier... after that all hell broke loose!

I'm running php artisan from root of the project and always getting the same error there.

Following a suggestion on other post to add the following code to Container.php

        dump($concrete, debug_backtrace());
        $reflector = new ReflectionClass($concrete);

I now have more debug info to help me, but don't feel I have the expertise required to pinpoint to the exact error. Can you give me a hand here? This is what I'm seing: http://afonsogomes.com/errorDump.html

govindkumar9784's avatar

hi @Penaf

it is same isssue in my project .Please help

run : - php artisan view:clear

error : -

In Finder.php line 547: The "" directory does not exist.

Please or to participate in this conversation.