[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);
}
}
Wrong repo: https://github.com/laravel/installer
@franzliedke issues are disabled on that repo.
Make a PR then, please. =)
https://github.com/laravel/installer/commit/141c8cfadea6268f8487fb2b8446c37b26de09e2 PR'ed and merged.
Thanks @crynobone. @kimoi This has been fixed already, but is not yet included in a tag.
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 :)
confirming the issues does exist when the folder already exists
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.
@zubair1 @ssojan-official
Try: composer global require "laravel/installer=dev-master
I got this error too while I was reading dev docs, and @ibrasho 's solution works well. Thank you.
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.
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.
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.
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 https://github.com/laravel/docs
Thanks @RomainLanz