Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

anon90444's avatar

Install Laravel to an existing folder

Previously laravel installer allowed me to install laravel within a current directory using

laravel new

Now it outputs an error message:

In NewCommand.php line 184: application already exists

How does one create a new laravel project within current directory with new installer?

I have done a composer global update to fetch the latest version and the issue persists.

0 likes
11 replies
jlrdw's avatar

Are you trying to override an existing application, otherwise you probably need a new name.

anon90444's avatar

I have created an empty github repository then cloned it, navigated inside the directory and used the command laravel new this always created all the required files within current directory with no issues no name required.

Surely they would not remove this?

tykus's avatar
tykus
Best Answer
Level 104

Looks like they accidentally borked that behaviour whenever they changed the installer recently.

2 likes
Victor Paredes's avatar

Yeah this is super unfortunate. I'm looking around for additional solutions, but it would be nice to do something like:

laravel new -c {project name}

-c or a similar flag for current directory.

Ashkar's avatar

Create projects using composer instead of laravel

And there is one more thing, your directory should be blank

composer create-project laravel/laravel .
3 likes
codelando's avatar

You can always create the Laravel project with Composer

composer create-project laravel/laravel my-laravel-project

Then clone your new repository into another folder

git clone https://github.com/your-username/your-repo

And finally copy the .git folder to your Laravel project

mv your-repo/.git/ my-laravel-project

From there you can add the files an commit normally from your Laravel project folder.

cd my-laravel-project
git add .
git commit -m "Initial Laravel files"
git push
AaronMangan's avatar

Very late reply, but just In case:

Using the laravel installer has a --force option which should let you create a new project in an existing git repo.

Navigate to the folder that contains the existing repo (the parent of your repo) and run: laravel new my-project-name --force

3 likes
Saiffer's avatar

@AaronMangan Laravel installation with --force would allow me to install into existing folder but it also deleted my .git folder before Laravel was installed. So this was not a solution.

Solution was (as wrote codelando above) to clone my empty git repository to another folder. And after normal Laravel installation of new project (into not existing folder) I had to copy the .git folder (from the cloned folder) to the folder with newly installed Laravel project.

Yassin A.'s avatar

I know this is old but you can create laravel in another folder and just copy everything in your current one.

1 like

Please or to participate in this conversation.