oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
72.27k stars 2.58k forks source link

`bunx nuxi init my-project` fails with `uv_tty_init returned EINVAL` #9948

Open gvilums opened 3 months ago

gvilums commented 3 months ago

What version of Bun is running?

1.1.1+ca1dbb4eb

What platform is your computer?

Darwin 23.4.0 arm64 arm

What steps can reproduce the bug?

run bunx nuxi init myproject, select bun as the package manager

What is the expected behavior?

it works

What do you see instead?

❯ bunx nuxi init test1

✔ Which package manager would you like to use?
bun
◐ Installing dependencies...                                                                                                                                                                                                                                                                   12:16:30 PM
bun install v1.1.1 (ca1dbb4e)

$ nuxt prepare

ℹ Nuxt collects completely anonymous data about usage.                                                                                                                                                                                                                                        12:16:32 PM
  This will help us improve Nuxt developer experience over time.
  Read more on https://github.com/nuxt/telemetry

 ERROR  TTY initialization failed: uv_tty_init returned EINVAL (invalid argument)                                                                                                                                                                                                              12:16:32 PM

  at new WriteStream (node:tty:93:11)
  at sD.prompt (node_modules/consola/dist/chunks/prompt.mjs:141:676)
  at confirm (node_modules/consola/dist/chunks/prompt.mjs:251:6)
  at Module.prompt (node_modules/consola/dist/chunks/prompt.mjs:404:18)
  at node_modules/consola/dist/shared/consola.36c0034f.mjs:617:71
  at async ensureUserconsent (node_modules/@nuxt/telemetry/dist/shared/telemetry.023ac76b.mjs:26:20)
  at async setup (node_modules/@nuxt/telemetry/dist/module.mjs:363:74)
  at async normalizedModule (node_modules/@nuxt/kit/dist/index.mjs:2112:17)
  at async installModule (node_modules/@nuxt/kit/dist/index.mjs:2415:95)
  at async initNuxt (node_modules/nuxt/dist/index.mjs:4233:7)

 ERROR  TTY initialization failed: uv_tty_init returned EINVAL (invalid argument)                                                                                                                                                                                                              12:16:32 PM

error: postinstall script from "nuxt-app" exited with 1

 ERROR  Error: Command failed with exit code 1: bun install                                                                                                                                                                                                                                    12:16:32 PM

Additional information

No response

andrasat commented 3 months ago

Hi, this might be related, bun install in my nuxt project also failed. It's also failing at nuxt prepare step. I'm using bun version 1.1.3

Screenshot 2024-04-09 at 13 33 14

andrasat commented 3 months ago

Downgrade to 1.0.36 fix this

Screenshot 2024-04-09 at 16 22 54

jonatandorozco commented 3 months ago

The issue is due to console input. The command prompts to select if the user wants to opt-in for nuxt telemetry.

image

Workaround: First install with node so you can answer the telemetry prompt, then you should be able to use bun as usual

koddr commented 2 months ago

I'm still getting this error in Bun v1.1.6 (e58d67b4) when running bunx nuxi@latest init project:

✔ Which package manager would you like to use?
bun
◐ Installing dependencies...                                                                                                                                                   5:23:03 PM
bun install v1.1.6 (e58d67b4)

$ nuxt prepare

 ERROR  (node:58315) [DEP0180] DeprecationWarning: fs.Stats constructor is deprecated.                                                                                         5:23:11 PM
(Use node --trace-deprecation ... to show where the warning was created)

ℹ Nuxt collects completely anonymous data about usage.                                                                                                                        5:23:12 PM
  This will help us improve Nuxt developer experience over time.
  Read more on https://github.com/nuxt/telemetry

 ERROR  TTY initialization failed: uv_tty_init returned EINVAL (invalid argument)                                                                                              5:23:12 PM

  at new WriteStream (node:tty:93:11)
  at sD.prompt (node_modules/consola/dist/chunks/prompt.mjs:141:676)
  at confirm (node_modules/consola/dist/chunks/prompt.mjs:251:6)
  at Module.prompt (node_modules/consola/dist/chunks/prompt.mjs:404:18)
  at node_modules/consola/dist/shared/consola.36c0034f.mjs:617:71
  at async ensureUserconsent (node_modules/@nuxt/telemetry/dist/shared/telemetry.023ac76b.mjs:26:20)
  at async setup (node_modules/@nuxt/telemetry/dist/module.mjs:363:74)
  at async normalizedModule (node_modules/@nuxt/kit/dist/index.mjs:2112:17)
  at async installModule (node_modules/@nuxt/kit/dist/index.mjs:2415:95)
  at async initNuxt (node_modules/nuxt/dist/index.mjs:4233:7)
  at async loadNuxt (node_modules/nuxt/dist/index.mjs:4331:5)
  at async loadNuxt (node_modules/@nuxt/kit/dist/index.mjs:2570:19)
  at async Object.run (node_modules/nuxi/dist/chunks/prepare.mjs:53:18)
  at async runCommand$1 (node_modules/nuxi/dist/shared/nuxi.9edf0930.mjs:1648:16)
  at async runCommand$1 (node_modules/nuxi/dist/shared/nuxi.9edf0930.mjs:1639:11)
  at async runMain$1 (node_modules/nuxi/dist/shared/nuxi.9edf0930.mjs:1777:7) 

 ERROR  TTY initialization failed: uv_tty_init returned EINVAL (invalid argument)                                                                                              5:23:12 PM

error: postinstall script from "nuxt-app" exited with 1

 ERROR  Error: Command failed with exit code 1: bun install  

Any ideas to solve this?

jonatandorozco commented 2 months ago

@koddr I put a workaround, but there is no definitive fix for it yet