简体   繁体   中英

I am trying to run a PHP app in aws server(centos), through composer but i ended up with the following error

This is the error it throws when I enter 'composer install'

> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

In Finder.php line 589:

  The "" directory does not exist.

I'm not sure what error this is as I don't have knowledge on PHP and I'm not sure what files I'm supposed to provide here so that my error would be understandable.

Please ask me if I need to provide any files. Thanks in advance.

UPDATE:

if (is_dir($dir)) {
                $resolvedDirs[] = $this->normalizeDir($dir);
            } elseif ($glob = glob($dir, (\defined('GLOB_BRACE') ? GLOB_BRACE : 0) | GLOB_ONLYDIR | GLOB_NOSORT)) {
                sort($glob);
                $resolvedDirs = array_merge($resolvedDirs, array_map([$this, 'normalizeDir'], $glob));
            } else {
                throw new DirectoryNotFoundException(sprintf('The "%s" directory does not exist.', $dir));

The error tells you that a given directory with empty name is tried to be reached successfully. Empty directories do not really exist, so it is safe to assume that you have a dynamic value, operating probably as a setting which specifies a path in your directory structure to copy file to/from.

Your error is not unique, it happened to other people, for example here is a post on a Laravel forum: https://laracasts.com/discuss/channels/laravel/laravel-in-finderphp-line-547-the-directory-does-not-exist

In that discussion, the solution was to clear composer cache and update the project. That would be the first thing I would do if I were you. If that does not solve your problem, then you will need to look into Finder.php, at line 589 and see what is referred to there, then search for the definition of that path in the project and if it is not properly defined, then to define it.

EDIT

Looked into the source-code at https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Finder/Finder.php

We have this method:

public function in($dirs)
{
    $resolvedDirs = [];

    foreach ((array) $dirs as $dir) {
        if (is_dir($dir)) {
            $resolvedDirs[] = $this->normalizeDir($dir);
        } elseif ($glob = glob($dir, (\defined('GLOB_BRACE') ? GLOB_BRACE : 0) | GLOB_ONLYDIR | GLOB_NOSORT)) {
            sort($glob);
            $resolvedDirs = array_merge($resolvedDirs, array_map([$this, 'normalizeDir'], $glob));
        } else {
            throw new DirectoryNotFoundException(sprintf('The "%s" directory does not exist.', $dir));
        }
    }

    $this->dirs = array_merge($this->dirs, $resolvedDirs);

    return $this;
}

The error says:

The "" directory does not exist.

Which means that $dir is empty String. This issue is caused by the fact that a wrong parameter was passed to the in method. If $dirs is an array , then one of its elements is empty String. If it's not an array , then converting it to an array creates an array with an empty string inside. To solve the error, the next step is to find out what $dirs contain and seeing the stack trace of the exception, because something wrong happened before calling this method, this method just couldn't handle the problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM