-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Yarn fails under git-bash: Can't answer a question unless a user TTY #4497
Comments
This looks a lot like a duplicate of #2591 so closing in favor of that. Reopen if you don't agree. |
Use PowerShell instead. |
I'm not satisfied that this thread ends with "You should use my preferred tool instead of your preferred tool". This is still a problem. NPM works, Yarn doesn't. How about some action here? @kittens @bestander @arcanis @sebmck @BYK @Daniel15 @rally25rs @zertosh @voxsim |
@alancnet sure, we always accept well-written and tested PRs |
My apologies @BYK, it seems this issue has been resolved in v1.17.0. It is still an issue in v1.16.0 which is what is published. I look forward to the next release. |
@alancnet don't really see anything that could have fixed this since 1.16.0: v1.16.0...master Are you sure this is not something else? |
@BYK You're right. When you Do you think it would be appropriate to add a |
@alancnet ooh, interesting find! I wonder why they diverge and I'd say this is a bug. So you have no issues when installing from If so we should file a new bug to align them. |
@BYK The shim shown on the left of my screenshot is when installing from |
@alancnet sorry for the late response! I definitely remember hitting this issue. So when Yarn detects Did some digging and seems like this behavior was introduced in #4577 to fix this exact issue and the code responsible lives in https://github.com/thetrompf/yarn/blob/master/bin/yarn I'm reopening the issue. Would you like to try fixing this and submitting a PR to become the hero of all these people :) I am also using Windows and I'd be happy to assist you in the PR journey. Once it is merged, it'll be available in the nightly builds pretty quickly. |
A similar behavior around I don't think auto-using winpty is a bad idea. The current https://github.com/yarnpkg/yarn/blob/master/bin/yarn is doing it right by making sure it is trying to do winpty only under a cygwin tty. What needs to be changed is how yarn, or cmd-shim, handles the |
I'm also experiencing this on OS X 10.14.5
|
Looks like it's a permission problem. |
Still not working on Windows with Git Bash. $ yarn upgrade-interactive --latest
yarn upgrade-interactive v1.22.4
info Color legend :
"<red>" : Major Update backward-incompatible updates
"<yellow>" : Minor Update backward-compatible features
"<green>" : Patch Update backward-compatible bug fixes
Done in 12.73s.
Error: Can't answer a question unless a user TTY |
Same problem |
1 similar comment
Same problem |
Does prefixing E. g. |
Usando o Windows10...com o git bash , ainda aparece esse mesmo erro . " error An unexpected error occurred: "Can't answer a question unless a user TTY". Mas usando o power shell modo administrador o yarn install funciona e gera o arquivo package.json |
Not sure if this thread is still relevant, in my case the fix was ensuring that my yarn version was set to yarn berry before I ran yarn init.
|
Same fix for me as @GuyARoss I had previously run |
Worked for me initially. But then it was still giving error when I tried to require packages. Those who are looking a solution for this, just use your terminal in vs code for |
Running into this same error message and I found one solution. I'm on Windows 10 and my project needs me to run
I tried the same command on:
I can't recall for sure but I think I installed yarn with Ubuntu 1-2 years ago. Maybe the other shells don't have the correct linkage or user permissions. |
Same problem Yarn Version: 1.22.7 |
Didn't realize until I actually used git bash 🤣 |
still the same problem, been 5 years or more. Latest yarn version on win 11 using gitbash :( |
Still happening but |
I think it doesn't work with git, I had the same problem but it started to work normally when I used powershell or command prompt. |
The problem is still happening as of today. |
facing the same issue as today: yarn v1.22.19 and |
+1 to @BehnamAxo comment. I am having the same exact issue. As stated previously workaround was to do |
@jorgefelico #4497 (comment) worked for me. |
Same issue, |
Do you want to request a feature or report a bug?
Bug.
What is the current behavior?
Running yarn init yields:
What is the expected behavior?
Standard init process.
Please mention your node.js, yarn and operating system version.
Versions:
Background Research
The problem was previously noted in:
#743
This yielded a fix that tried to autodetect mintty and use winpty:
#2243
That fix worked for interactive operations but breaks any sort of piping.
This fix was removed in favor a explicit environment variable in:
#2998
The reason being yarn shell commands seemed to fail because of winpty when used in a pipe. And there appears to be some terminal output that shows git bash working without the need for
winpty
. This is not consistent with my experience.Technical details
I believe yarn uses
isTTY
to check for an interactive terminal. The discussion attributed the issue to be caused bywinpty
however running node by itself can produce that error:I think that's the check that's actually causing the issue when any yarn command is involved in a pipe. But weirdly using
yarn
in a pipe works for commands that are not interactive like--version
.Below is a bunch of commands I ran on the terminal that I hope help diagnose the issue.
There's a lot of moving pieces so its hard for me to understand the cause and effect here. So I'm not sure of a good solution that keeps this interactive terminal check.
My initial thought is that this check for interactive terminal isn't really worth the hassle of keeping around. If you design a script that has
yarn init
and fail to provide input or redirect properly and it spins forever waiting that should be on you right? Npm doesn't do this and I suspect its because of these kinds of problems.Summary
It would seem that I have to use the
YARN_FORCE_WINPTY
when using an interactive command in git bash and specifically not use that when trying to do any piping.Further,
YARN_FORCE_WINPTY
isn't documented anywhere as far as I know. Other than the old issues and the script itself. Maybe add that to the error message?Regardless of all that I just want to be able to type
yarn init
and have it work consistently without having to do anything special to make it work on windows.The text was updated successfully, but these errors were encountered: