Cannot create Sveltekit app - ERR_TTY_INIT_FAILED uv_tty_init returned EBADF (bad file descriptor)
Asked Answered
R

3

21

When I run the recommended $ npm create svelte@latest myapp, I get the following error:

 Welcome to SvelteKit!
node:internal/errors:490
    ErrorCaptureStackTrace(err);
    ^

SystemError [ERR_TTY_INIT_FAILED]: 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/Skylan/AppData/Local/npm-cache/_npx/50a6160ffc29bafc/node_modules/@clack/core/dist/index.mjs:9:693)
    at Module.ee (file:///C:/Users/Skylan/AppData/Local/npm-cache/_npx/50a6160ffc29bafc/node_modules/@clack/prompts/dist/index.mjs:28:7)
    at template (file:///C:/Users/Skylan/AppData/Local/npm-cache/_npx/50a6160ffc29bafc/node_modules/create-svelte/bin.js:48:6)
    at Module.$e (file:///C:/Users/Skylan/AppData/Local/npm-cache/_npx/50a6160ffc29bafc/node_modules/@clack/prompts/dist/index.mjs:80:345)
    at file:///C:/Users/Skylan/AppData/Local/npm-cache/_npx/50a6160ffc29bafc/node_modules/create-svelte/bin.js:45:25
    at ModuleJob.run (node:internal/modules/esm/module_job:194:25) {
  code: 'ERR_TTY_INIT_FAILED',
  info: {
    errno: -4083,
    code: 'EBADF',
    message: 'bad file descriptor',
    syscall: 'uv_tty_init'
  },
  errno: [Getter/Setter],
  syscall: [Getter/Setter]
}

Full log

It looks liek the error happens AFTER the create?

34 http fetch GET 200 https://registry.npmjs.org/create-svelte 144ms (cache revalidated)
35 timing arborist:ctor Completed in 0ms
36 timing arborist:ctor Completed in 1ms
37 timing command:create Completed in 299ms
38 verbose stack Error: command failed
38 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\promise-spawn\lib\index.js:53:27)
38 verbose stack     at ChildProcess.emit (node:events:513:28)
38 verbose stack     at maybeClose (node:internal/child_process:1091:16)
38 verbose stack     at ChildProcess._handle.onexit (node:internal/child_process:302:5)

I've tried updating/reinstalling node, there aren't really any googles or answers I found dealing with npm create svelte

Roush answered 15/3, 2023 at 22:43 Comment(1)
I had this problem too when using it in MINGW64. It works if you run it in the VSCode terminal. There's a lot of fancy prompts so it's probably related to that.Clemenceau
H
25

I was using git bash terminal and I was getting this error too, I've changed to Vscode terminal (it's bash too) and it worked, I don't know why but it worked.

Hoist answered 31/3, 2023 at 14:45 Comment(2)
I had the exact same issue.Quake
Changing terminals solved the issue for me too, I was using git bash, then switched to Windows PowerShell and it worked flawlesslyRoslynrosmarin
G
0

I think it might be an issue with svelte@latest

I ran npm create [email protected] myapp and it seems like it will create a project, although it seems pretty buggy

Genera answered 15/3, 2023 at 23:14 Comment(0)
M
0

Changing package manger to pnpm solved my problem.

I've created Nuxt project and tried to install deps by running bun i and npm i - both ended with TTY initialization failed: uv_tty_init returned EBADF (bad file descriptor) error. Changing terminal didn't work.

I've tried to pnpm i and it worked. Don't know why.

Milford answered 24/4 at 9:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.