Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--no-interaction still requires interaction #355

Closed
stancl opened this issue Sep 3, 2024 · 10 comments
Closed

--no-interaction still requires interaction #355

stancl opened this issue Sep 3, 2024 · 10 comments

Comments

@stancl
Copy link

stancl commented Sep 3, 2024

Installer Version

dev-master

Description

Reposting my comment here as a proper issue since it didn't get addressed there:

Not sure if I'm doing something wrong, but even on laravel/installer:dev-master I'm getting

The SQLite database configured for this application does not exist: database/database.sqlite.

with:

laravel new --no-interaction --git --jet --stack=livewire --api --verification --pest --database=sqlite test

Also (in response to what OP wrote there), --force having an effect here seems wrong since the --help comment for --force is:

Forces install even if the directory already exists

So that behavior should all be under --no-interaction.

Either way, on the latest dev-master, the command above prompts me for both creating the DB and re-running migrations, and --force doesn't change anything 🤷🏻‍♂️

Confirmed with composer global show laravel/installer that I'm using the right commit:

source   : [git] https://github.com/laravel/installer.git db5f79dda5bd9b84c0777da435d2147c5caa4068

Steps To Reproduce

composer global require laravel/installer:dev-master
laravel new --no-interaction --git --jet --stack=livewire --api --verification --pest --database=sqlite test
@laravel laravel deleted a comment Sep 3, 2024
Copy link

github-actions bot commented Sep 3, 2024

Thank you for reporting this issue!

As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub.

If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team.

Thank you!

@Jubeki
Copy link
Contributor

Jubeki commented Sep 12, 2024

Hey do you use Laravel Herd by any chance? Because then you would use the laravel installer from them and not the one globally installed via composer.

@Jubeki
Copy link
Contributor

Jubeki commented Sep 12, 2024

I checked, I have globally 5.8.5 installed, but Herd is still running 5.8.3.

You can check with the following commands:

which laravel
laravel --version

@stancl
Copy link
Author

stancl commented Sep 12, 2024

Ah that's my bad for not checking which laravel, didn't think Herd would be overriding that.

➜  ~ ~/.composer/vendor/laravel/installer/bin/laravel --version
Laravel Installer 5.8.4
➜  ~ laravel --version
Laravel Installer 5.8.3

Let me test again using the composer version.

@Jubeki
Copy link
Contributor

Jubeki commented Sep 12, 2024

I don't think it is your bad. I also didn't assume that and tried to debug your issue. That is when I found out about it. (Or more like was reminded again about this issue).

The installer will probably be updated in the next Herd version. (At least I hope so)

@stancl
Copy link
Author

stancl commented Sep 12, 2024

Okay, I tested it now and the composer version (56898ec) still prompts for rerunning migrations, while the Herd version (5.8.3) prompts me for creating the database and re-running the migrations. So the linked PR fixing the SQLite issue does solve that one issue, but the installer still has issues with --no-interaction not covering re-running migrations (at least in the case of Jetstream).

@Jubeki
Copy link
Contributor

Jubeki commented Sep 12, 2024

Okay, then I will continue debugging!

@Jubeki
Copy link
Contributor

Jubeki commented Sep 12, 2024

Not sure what the best way would be.

The change needs to be done at Jetstream:
https://github.com/laravel/jetstream/blob/84970f29ec8ccd78606863ddcb54f7377d48edb0/src/Console/InstallCommand.php#L756-L770

You would add something like this:

// Don't run migrations automatically
! $this->option('no-interaction') && confirm('...')

// Run migrations automatically
$this->option('no-interaction') || confirm('...')

But you would then to manually re-run the migrations (something which could also be handled by the Laravel installer, because it knows you didn't have time to change some code).

@eleftrik
Copy link

eleftrik commented Sep 29, 2024

@stancl Same here (version 5.8.3)

My bad. I'm using Herd and I just noticed laravel new used 5.8.3.

If I run

composer global require laravel/installer   # got 5.8.5
alias laravel=~/.composer/vendor/laravel/installer/bin/laravel

laravel new filament --git --database=sqlite --pest --no-interaction

...then everything runs as expected (no prompts for database creations or running migrations).

@crynobone
Copy link
Member

Thanks @eleftrik

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants