I have faced the same issue while creating a new project on the latest Laravel through Composer but didn't find any solution and at the last, I tried to create a Laravel project by the following command and it's working as expected.
composer create-project --prefer-dist laravel/laravel ProjectName
or, you should remove that folder and let it be created by command as follows:
laravel new ProjectName
Explanation:
As I get the following error.
_ _
| | | |
| | __ _ _ __ __ ___ _____| |
| | / _` | '__/ _` \ \ / / _ \ |
| |___| (_| | | | (_| |\ V / __/ |
|______\__,_|_| \__,_| \_/ \___|_|
In NewCommand.php line 184:
Application already exists!
new [--dev] [--jet] [--stack [STACK]] [--teams] [-f|--force] [--] [<name>]
I tried to figure out this issue and found a function that is placed under %appdata%\Composer\vendor\laravel\installer\src\NewCommand.php on line 184 as follows:
/**
* Verify that the application does not already exist.
*
* @param string $directory
* @return void
*/
protected function verifyApplicationDoesntExist($directory)
{
if ((is_dir($directory) || is_file($directory)) && $directory != getcwd()) {
throw new RuntimeException('Application already exists!');
}
}
here verifyApplicationDoesntExist function is checking that the application folder you are trying to create has existed or not, it's not checking the application folder's size so it doesn't matter if the folder is empty or not. so due to code like that, the composer thinks application already been created that's why it throws an error like your application already exists.
To tackle this issue, you just need to delete your empty project folder and create it by command laravel new ProjectName and that will create project folder itself without giving any error like Application already exist!.