nuxt/cli

Post installation script fails when using bun for windows

Opened this issue · 10 comments

Environment

  • Operating System: Windows_NT
  • Node Version: v21.7.1
  • Nuxt Version: -
  • CLI Version: 3.11.1
  • Nitro Version: -
  • Package Manager: unknown
  • Builder: -
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

Reproduction

When i try to create a new nuxt project with bun for windows, the nuxt post install script throws an error. More specifically "TTY initialization faild"

Describe the bug

When i try to create a new nuxt project with bun for windows, the nuxt post install script throws an error. More specifically "TTY initialization failed"

Additional context

No response

Logs

ERROR  TTY initialization failed: uv_tty_init returned EBADF (bad file descriptor)                           17:34:17

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



 ERROR  TTY initialization failed: uv_tty_init returned EBADF (bad file descriptor)                           17:34:17

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

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

This seems like a bug in Bun. Have you raised it there?

The issue is fixed in bun 1.1.1

Doesn't seem to be fixed in bun 1.1.1, getting the same error in 1.1.3

This issue also appears when using npx, not only bunx

UPD: persists on MacOS and Windows

Yes, I got this too

the error seems to come from the 'nuxt telemetry' prompt. But I still can't figure it out.

EDIT: solved with bunx @nuxt/telemetry disable -g

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)

me too

ibqn commented

also observe this error on windows

Also observing this in WSL.
I fixed it with by doing NUXT_TELEMETRY_DISABLED=1 bunx nuxi@latest init <project>

Having the same issue here when using bun. Disabling @nuxt/telemetry did not work as well.
It was only possible to init a new nuxt project with npx and yarn.