Comments (12)
You are correct @cfreear.
Thing is that before we were simply downloading and extracting a zip file which meant things were quite happy to just extract in place.
Now we're using composer create-project which due to it essentially being a git clone and then deleting the .git directory, doesn't work in a non-empty directory.
Realistically we could fix this by using create-project into a tmp directory, and then copying the files over, but I don't believe it's worth the additional complexity it would introduce.
from installer.
From this am I correct in assuming that while using laravel new . --force
to create a new Laravel app in the current directory that may contain other files (.git, .idea etc.) used to work on previous versions of installer it was not a supported use case?
from installer.
I need to create new project and only .git directory is present. I think this is a bug because .git directory doesn't affects in any way.
from installer.
Think 1. makes sense to me. Use the $this->error
method instead of throwing an exception.
from installer.
Just notice that I have the similar issue when using the laravel new --dev
on current folder.
Steps To Reproduce:
- All commands are run on Ubuntu 18.04 operating system. And the
laravel/installer
is installed globally. - Create directory
app
on my home directory. - Using
cd $HOME/app
to change directory. - On above directory, running
laravel new --dev
to try to create a new Laravel Application Project.
Expected
- It should install or override the application project on above directory.
Actual
- I get following error message:
_ _
| | | |
| | __ _ _ __ __ ___ _____| |
| | / _` | '__/ _` \ \ / / _ \ |
| |___| (_| | | | (_| |\ V / __/ |
|______\__,_|_| \__,_| \_/ \___|_|
In NewCommand.php line 153:
Application already exists!
new [--dev] [--jet] [-f|--force] [--] [<name>]
When using the laravel new --dev --force
command to run above steps again, it will get following error:
_ _
| | | |
| | __ _ _ __ __ ___ _____| |
| | / _` | '__/ _` \ \ / / _ \ |
| |___| (_| | | | (_| |\ V / __/ |
|______\__,_|_| \__,_| \_/ \___|_|
Creating a "laravel/laravel" project at "./"
[InvalidArgumentException]
Project directory "/home/directory/app" is not empty.
I think it should be good to add asking question about Application /home/directory/app is existed. Do you want to override them?
interactively.
from installer.
Should be fixed I think
from installer.
@driesvints it's definitely not fixed in the latest release (v4.0.3) which was released after your comment, so I'd assume the fix would have been in there if it was truly fixed.
Edit:
After looking more into this, the issue is that Laravel uses --force
to delete the named directory if it's not ".".
However if it is "." then it just skips that option. Unfortunately composer create-project has no way to say "do your thing even through this directory is not empty" so there's not a lot here that the installer can do to fix it.
It would I believe be worth throwing an error if the name "." and the --force
flag are used together, and also updating the option description to explain what it's doing e.g. "Remove the project directory if it already exists",
I wouldn't have expected --force
to delete the named directory - I would have expected whatever files were there to be kept (and possible overwritten of the installer wanted to place files with the same name). Possibly even renaming the option to "--delete" or similar would be appropriate.
from installer.
@hailwood can you send a pr?
from installer.
@driesvints I'm happy to, what would you like in the PR?
- Throw error if "." path and
--force
flag used together - Update description of
--force
to "Remove the project directory if it already exists" - Rename
--force
to--delete
from installer.
Not 100% sure about that.
from installer.
No worries, looks like it's a wontfix from composers side anyway. My typical workflow involves opening an empty folder in phpstorm (which creates an .idea folder) and using the built in terminal to run laravel new
. I'll just have to remember to do it the other way round! 😅
from installer.
@hailwood agreed
from installer.
Related Issues (20)
- Not installing usable Jetstream + Livewire scaffolding HOT 1
- Docs link broken/missing from docs HOT 2
- Error installing Laravel on a Github Codespace (it worked yesterday 2023-12-18) HOT 4
- Call to `http://cabinet.laravel.com/*.zip` is returning a 404 HOT 11
- Add check to installer to see if you're on the latest version
- Database option HOT 1
- Incorrect version of the Pest package HOT 5
- issues when install laravel with mysql HOT 3
- [11.x] The config files are back in the skeleton HOT 2
- Laravel 11 laravel/installer 5.6 not tagged HOT 1
- Removing unnecessary migration prompt when database connection settings are not configured HOT 1
- Option to select database type from command line HOT 1
- Database name is set to directory even with an actual DBMS set in options HOT 2
- Database.sqlite is created even if you slect mysql HOT 1
- breeze installs breeze without --dev flag HOT 1
- NewCommand does not check for herd valet existence HOT 5
- --database=sqlite with --jet causes Jetstream migration run to fail (database.sqlite is not created)
- Installer asks user password every time HOT 4
- Unnecessary SQLite Migrations Run at Installation HOT 3
- Running with `--no-interaction` still prompts about SQLite file HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from installer.