framework icon indicating copy to clipboard operation
framework copied to clipboard

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

Open hayleyxyz opened this issue 12 years ago • 16 comments

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);
    }
}

hayleyxyz avatar Sep 27 '14 13:09 hayleyxyz

Wrong repo: https://github.com/laravel/installer

franzliedke avatar Sep 27 '14 13:09 franzliedke

@franzliedke issues are disabled on that repo.

GrahamCampbell avatar Sep 27 '14 13:09 GrahamCampbell

Make a PR then, please. =)

franzliedke avatar Sep 27 '14 13:09 franzliedke

https://github.com/laravel/installer/commit/141c8cfadea6268f8487fb2b8446c37b26de09e2 PR'ed and merged.

crynobone avatar Sep 27 '14 14:09 crynobone

Thanks @crynobone. @kimoi This has been fixed already, but is not yet included in a tag.

GrahamCampbell avatar Sep 27 '14 14:09 GrahamCampbell

Guys, this issue is still there. I just ran into it. But i wasn't aware it was happening to due the folder/directory already being created before running the command. Shouldn't it just overwrite the contents of the folder prior to showing a confirmination? currently its printing ugly messages.

Sorry but the terms PR you used above goes over my head so i am not sure where to report this properly. Its my first ever comment :)

zubair1 avatar Oct 17 '14 11:10 zubair1

confirming the issues does exist when the folder already exists

sojan-official avatar Dec 30 '14 15:12 sojan-official

Guys, this issue is still there

Yeh, it still exists in the current tag. It will be fixed in the next tag - it's already fixed on the master.

GrahamCampbell avatar Dec 30 '14 15:12 GrahamCampbell

@zubair1 @ssojan-official Try: composer global require "laravel/installer=dev-master

ibrasho avatar Dec 30 '14 17:12 ibrasho

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

friparia avatar Jan 22 '15 07:01 friparia

Issue still there but as @friparia said; it does work if you use the master branch(composer global require "laravel/installer=dev-master) before creating the project.

malsec-dev avatar Feb 04 '15 17:02 malsec-dev

I ran into that issue too but ended up just using the composer install method instead ("composer create-project laravel/laravel --prefer-dist"). That method creates the install as a new directory called "laravel" that you can then rename.

orrd avatar Feb 05 '15 03:02 orrd

Just to add to orrd's comment, you could also go for composer create-project laravel/laravel yourfolder Laravel will be installed with all its dependencies in the folder named yourfolder in the current directory. So there wouldn't be any need to rename the folder later.

adarshchacko avatar Feb 11 '15 18:02 adarshchacko

Just hit this bug too. While we wait for a tagged release to fix this, can we at least put a line in the docs?

http://laravel.com/docs/5.0/installation

Is there a repo or anything where we can PR for the docs?

njt1982 avatar Feb 22 '15 23:02 njt1982

@njt1982 https://github.com/laravel/docs

RomainLanz avatar Feb 23 '15 00:02 RomainLanz

Thanks @RomainLanz

njt1982 avatar Feb 23 '15 10:02 njt1982