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

Installation not working #286

Closed
sixtusagbo opened this issue Sep 29, 2023 · 14 comments · Fixed by laravel/prompts#91
Closed

Installation not working #286

sixtusagbo opened this issue Sep 29, 2023 · 14 comments · Fixed by laravel/prompts#91
Assignees
Labels

Comments

@sixtusagbo
Copy link

sixtusagbo commented Sep 29, 2023

Installer Version

5.1.2

Description

The installation is not even starting at all. I'm getting this error:

In Interactivity.php line 32:

  Required.

Steps To Reproduce

composer global require laravel/installer

laravel new namodin

@jessarcher jessarcher self-assigned this Sep 29, 2023
@jessarcher
Copy link
Member

Hey @sixtusagbo,

What operating system are you running the laravel new command on?

@jessarcher jessarcher added the bug label Sep 29, 2023
@sixtusagbo
Copy link
Author

Windows 10 Version 22H2 (OS Build 19045.3448)

@jessarcher
Copy link
Member

Thanks @sixtusagbo,

Are you able to give me the results of this command:

php -r "var_dump(stream_isatty(STDIN));"

(I'm not sure if it should be php.exe instead of just php)

@sixtusagbo
Copy link
Author

sixtusagbo commented Sep 29, 2023

Just php is okay, anyone can work. I use mingw on bash.
The result of that command is bool(true)

@iyefreedy
Copy link

I've had the same issue as @sixtusagbo mentioned.
Is it solved ?

@jessarcher
Copy link
Member

Hi @iyefreedy,

Not yet. Could you please tell me your operating system and the result of running the command from #286 (comment).

@iyefreedy
Copy link

image
This is the result of the command.
And I am using Windows 10 Education 64-bit operating system (10.0, Build 190454)

@jessarcher
Copy link
Member

Thanks both!

I'm struggling to figure out what's going on here. The code that triggers that error should only execute if stream_isatty(STDIN) is false.

I'm just setting up a Windows machine to try to replicate this.

@jessarcher
Copy link
Member

@iyefreedy are you also using mingw on bash? Or something different?

@jessarcher
Copy link
Member

jessarcher commented Sep 29, 2023

I've replicated the issue.

Very strange behaviour. The stream_isatty function returns differently depending on whether you execute the script directly, or pass it as an argument to php.

Take the following test.php file for example:

#!/usr/bin/env PHP
<?php

var_dump(stream_isatty(STDIN));

And note the different result depending on how you execute it:

$ php test.php
bool(true)

$ ./test.php
bool(false)

While I look into this, you can run the installer with the -n flag to make it non-interactive. E.g.:

laravel new example-app -n

@jessarcher
Copy link
Member

jessarcher commented Sep 29, 2023

This is caused by mintty and its use of a pipe instead of a TTY.

php is aliased to wintty php.exe, which is why that works. php.exe is not aliased, nor are scripts with a shebang, so those don't work.

I can't find a reliable way to detect whether STDIN is interactive when using mintty so I need to re-think the approach for non-interactive mode in https://github.com/laravel/prompts.

The easiest solution for the time being is probably just to make the fallback mode take priority over the non-interactive mode. An alternative would be to force interactive mode when mintty is used without wintty, but this would still cause issues when mintty is not actually interactive.

@driesvints
Copy link
Member

Try again all?

@jessarcher
Copy link
Member

LGTM (after composer global update)

image

@mstfkhazaal
Copy link

I have same error in Mac
i use sail https://laravel.com/docs/10.x/installation#sail-on-macos

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

Successfully merging a pull request may close this issue.

5 participants