the system I use: win7 64bit
when I type in yarn init,the problem occurred:
$ yarn init
yarn init v0.15.1
error Can't answer a question unless a user TTY
at ConsoleReporter.question (C:\Program Files (x86)\Yarn\lib-legacy\reporters\console\console-reporter.js:201:59)
at Object.<anonymous> (C:\Program Files (x86)\Yarn\lib-legacy\cli\commands\init.js:97:38)
at next (native)
at step (C:\Program Files (x86)\Yarn\node_modules\babel-runtime\helpers\asyncToGenerator.js:17:30)
at C:\Program Files (x86)\Yarn\node_modules\babel-runtime\helpers\asyncToGenerator.js:28:20
at run (C:\Program Files (x86)\Yarn\node_modules\core-js\library\modules\es6.promise.js:87:22)
at C:\Program Files (x86)\Yarn\node_modules\core-js\library\modules\es6.promise.js:100:28
at flush (C:\Program Files (x86)\Yarn\node_modules\core-js\library\modules\_microtask.js:18:9)
at nextTickCallbackWith0Args (node.js:420:9)
at process._tickCallback (node.js:349:13)
info Visit http://yarnpkg.com/en/docs/cli/init for documentation about this command.
what's the reason of it?
Try using PowerShell or cmd.exe.
@FLGMwt thank you,the problem is solved.
Using an alternative does not fix the initial problem. I am using MINGW64 (Git Bash) and do not want to use PowerShell/CMD...
I encounted the same problem with git bash, (yarn version 0.20.3) but it's fine with CMD.
Try adding the following to your .bashrc file:
alias yarn='node "C:\Program Files (x86)\Yarn\bin\yarn.js"'
Running yarn init should work now.
when i used Git bash here, I met the same question, you can use CMD to solve this problem
@ROCKBOOM You ain't solving any problem. You are just using a workaround.
When your teeth hurt, you can use paracetamol to lessen the pain. But you are not fixing the issue. The disease is still there, you are just ignoring it.
This issue is a bug that needs to be fixed.
@ScottyFillups Thank You;
But I think if you use npm install -g yarn to get yarn, it's better to alias yarn like this:
alias yarn='node C:\\Users\\UserName\\AppData\\Roaming\\npm\\node_modules\\yarn\\bin\\yarn.js'
@BriFuture You're welcome :smile:
You're probably right about the alias; I'm not a Windows expert, and at the time I was just scrambling to find a hotfix. These days I use Arch Linux instead.
I'll keep your comment in mind though if I need to help some friends install yarn on their PCs; thanks :wink:
Most helpful comment
Try using PowerShell or cmd.exe.