BuilderIO / ai-shell

A CLI that converts natural language to shell commands.
MIT License
4.11k stars 264 forks source link

TTY initialization failed: uv_tty_init returned EBADF (bad file descriptor) #84

Open gultar opened 1 year ago

gultar commented 1 year ago

Hi! I keep getting the error shown below when running basic "ai" commands. Any idea what is might be? I'm running it on Windows 10, and Git bash. For some reason, it doesn't work on Powershell, but it does on cmd.exe

$ ai How do you declare a new route in a Flask server?

T  AI Shell
|
o  Your script:

powershell
write-host "To declare a new route in a Flask server, you can add the route decorator to a function definition within the Flask app instance, like this: @app.route('/new_route')" -ForegroundColor Green

•
|
o  Explanation:

1. Initializes a PowerShell script.
2. Prints a message using the "write-host" command.
3. The message describes how to declare a new route in a Flask server by using the "@app.route('/new_route')" decorator.
4. The message is displayed in green text using the "-ForegroundColor" parameter.

•

✖ TTY initialization failed: uv_tty_init returned EBADF (bad file descriptor)
    at new SystemError (node:internal/errors:250:5)
    at new NodeError (node:internal/errors:361:7)
    at new WriteStream (node:tty:93:11)
    at ED.prompt (file:///C:/Users/sacha/AppData/Roaming/npm/node_modules/@builder.io/ai-shell/node_modules/@clack/core/dist/index.mjs:9:693)
    at Module.ee (file:///C:/Users/sacha/AppData/Roaming/npm/node_modules/@builder.io/ai-shell/node_modules/@clack/prompts/dist/index.mjs:28:7)
    at runOrReviseFlow (file:///C:/Users/sacha/AppData/Roaming/npm/node_modules/@builder.io/ai-shell/dist/cli.mjs:1736:26)
    at prompt (file:///C:/Users/sacha/AppData/Roaming/npm/node_modules/@builder.io/ai-shell/dist/cli.mjs:1732:9)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

    ai-shell v1.0.1

    Please open a Bug report with the information above:
    https://github.com/BuilderIO/ai-shell/issues/new
Ra3d0r commented 1 year ago

I encountered the same problem, showed the same error. Only runs ai-shell in cmd, but bash and PowerShell give an error.

However, everything worked in bash in VScode, so I decided to update the git version along with bash. I had a version of Git for Windows v2.36.1 and I updated it via PowerShell to the latest v2.41.0.

I updated using the command in PowerShell: git update-git-for-windows

Now ai-shell works in the bash terminal separately from VScode.