framework: [Laravel installer] Installer fails ungracefully when verifyApplicationDoesntExist() check fails

Running laravel new <project name> when the project folder already exists throws this error:

PHP Notice:  Undefined variable: output in C:\Users\Oscar\AppData\Roaming\Composer\vendor\laravel\installer\src\NewCommand.php on line 55

PHP Fatal error:  Call to a member function writeln() on a non-object in C:\Users\Oscar\AppData\Roaming\Composer\vendor\laravel\installer\src\NewCommand.php on line 55

This seems to be because $output does not exist in the scope of this method:

protected function verifyApplicationDoesntExist($directory)
{
    if (is_dir($directory))
    {
        $output->writeln('<error>Application already exists!</error>');

        exit(1);
    }
}

About this issue

  • Original URL
  • State: closed
  • Created 12 years ago
  • Comments: 16 (8 by maintainers)

Most upvoted comments

I got this error too while I was reading dev docs, and @ibrasho 's solution works well. Thank you.