Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EBADF: bad file descriptor #348

Open
wer-jp-kyaw-min-hein opened this issue Dec 5, 2023 · 3 comments
Open

EBADF: bad file descriptor #348

wer-jp-kyaw-min-hein opened this issue Dec 5, 2023 · 3 comments
Assignees

Comments

@wer-jp-kyaw-min-hein
Copy link

I encounter error like this: Choose the target platform: Express.js
? Choose the architecture for your project: Ts.ED
? Choose the convention file styling: Ts.ED
? Check the features needed for your project Database, Passport.js,
Testing
? Choose a ORM manager Prisma
? Choose unit framework Jest
? Choose the package manager: NPM
↓ Write RC files [SKIPPED]
✖ EBADF: bad file descriptor, write
◼ Install plugins
◼ Load plugins
◼ Install plugins dependencies
Error: EBADF: bad file descriptor, write
at Object.writeFileSync (node:fs:2352:20)
at CliFs.writeFileSync (/Users/supyaesone/.npm-global/lib/node_modules/@tsed/cli/node_modules/@tsed/cli-core/lib/cjs/services/CliFs.js:35:25)
at ProjectPackageJson.write (/Users/supyaesone/.npm-global/lib/node_modules/@tsed/cli/node_modules/@tsed/cli-core/lib/cjs/services/ProjectPackageJson.js:231:17)
at ProjectPackageJson.init (/Users/supyaesone/.npm-global/lib/node_modules/@tsed/cli/node_modules/@tsed/cli-core/lib/cjs/services/ProjectPackageJson.js:253:14)
at Task.task (/Users/supyaesone/.npm-global/lib/node_modules/@tsed/cli/lib/cjs/commands/init/InitCmd.js:115:44)
at Task.run (/Users/supyaesone/.npm-global/lib/node_modules/@tsed/cli/node_modules/listr2/dist/index.cjs:978:35)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
name: 'CLI_ERROR',
cli: Cli { injector: [Getter], cliService: [Getter] },
origin: Error: EBADF: bad file descriptor, write
at Object.writeFileSync (node:fs:2352:20)
at CliFs.writeFileSync (/Users/supyaesone/.npm-global/lib/node_modules/@tsed/cli/node_modules/@tsed/cli-core/lib/cjs/services/CliFs.js:35:25)
at ProjectPackageJson.write (/Users/supyaesone/.npm-global/lib/node_modules/@tsed/cli/node_modules/@tsed/cli-core/lib/cjs/services/ProjectPackageJson.js:231:17)
at ProjectPackageJson.init (/Users/supyaesone/.npm-global/lib/node_modules/@tsed/cli/node_modules/@tsed/cli-core/lib/cjs/services/ProjectPackageJson.js:253:14)
at Task.task (/Users/supyaesone/.npm-global/lib/node_modules/@tsed/cli/lib/cjs/commands/init/InitCmd.js:115:44)
at Task.run (/Users/supyaesone/.npm-global/lib/node_modules/@tsed/cli/node_modules/listr2/dist/index.cjs:978:35)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
errno: -9,
code: 'EBADF',
syscall: 'write'
}
} `

I try to reinstall node.js but it didn't solved. Also after I command this npm install -g @tsed/cli tsed init .didn't found every time.

@Romakita
Copy link
Contributor

Hello @wer-jp-kyaw-min-hein
I'm not able to reproduce this bug. It seems to be a problem with your file system.

I let open this issue if the problem persist.

See you

@kerwanp
Copy link

kerwanp commented Apr 29, 2024

I am getting the exact same issue. Tried with both npm and bun.

After copying the error I realized that I was running on Node 21. Version 20 works.

workspace/random/tsed is 📦 v1.0.0 via  v21.3.0 
❯ tsed init .                                                                                                                                                            
? Choose the target Framework: Express.js
? Choose the architecture for your project: Ts.ED
? Choose the convention file styling: Ts.ED
? Check the features needed for your project Database, Swagger
? Choose a ORM manager Prisma
? Choose the runtime: Node.js
? Choose the package manager: NPM
↓ Write RC files [SKIPPED]
✖ EBADF: bad file descriptor, write
◼ Install plugins
◼ Load plugins
◼ Install plugins dependencies
Error: EBADF: bad file descriptor, write
    at Object.writeFileSync (node:fs:2352:20)
    at CliFs.writeFileSync (/home/martin/.local/share/nvm/v21.3.0/lib/node_modules/@tsed/cli/node_modules/@tsed/cli-core/lib/cjs/services/CliFs.js:35:25)
    at ProjectPackageJson.write (/home/martin/.local/share/nvm/v21.3.0/lib/node_modules/@tsed/cli/node_modules/@tsed/cli-core/lib/cjs/services/ProjectPackageJson.js:196:17)
    at PackageManagersModule.init (/home/martin/.local/share/nvm/v21.3.0/lib/node_modules/@tsed/cli/node_modules/@tsed/cli-core/lib/cjs/packageManagers/PackageManagersModule.js:41:33)
    at Task.task (/home/martin/.local/share/nvm/v21.3.0/lib/node_modules/@tsed/cli/lib/cjs/commands/init/InitCmd.js:131:48)
    at Task.run (/home/martin/.local/share/nvm/v21.3.0/lib/node_modules/@tsed/cli/node_modules/listr2/dist/index.cjs:978:35)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  name: 'CLI_ERROR',
  cli: Cli { injector: [Getter], cliService: [Getter] },
  origin: Error: EBADF: bad file descriptor, write
      at Object.writeFileSync (node:fs:2352:20)
      at CliFs.writeFileSync (/home/martin/.local/share/nvm/v21.3.0/lib/node_modules/@tsed/cli/node_modules/@tsed/cli-core/lib/cjs/services/CliFs.js:35:25)
      at ProjectPackageJson.write (/home/martin/.local/share/nvm/v21.3.0/lib/node_modules/@tsed/cli/node_modules/@tsed/cli-core/lib/cjs/services/ProjectPackageJson.js:196:17)
      at PackageManagersModule.init (/home/martin/.local/share/nvm/v21.3.0/lib/node_modules/@tsed/cli/node_modules/@tsed/cli-core/lib/cjs/packageManagers/PackageManagersModule.js:41:33)
      at Task.task (/home/martin/.local/share/nvm/v21.3.0/lib/node_modules/@tsed/cli/lib/cjs/commands/init/InitCmd.js:131:48)
      at Task.run (/home/martin/.local/share/nvm/v21.3.0/lib/node_modules/@tsed/cli/node_modules/listr2/dist/index.cjs:978:35)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
    errno: -9,
    code: 'EBADF',
    syscall: 'write'
  }
}

@Romakita
Copy link
Contributor

Hello @kerwanp
Thanks for the issue, I’ll to reproduce the bug, but non LTS node version isn’t a prioritary goals for me. A lot of bug can be related directly by these versions and are solved in LTS by the node.js team. I suggest you to stay on LTS version to develop your app for a production environment.

see you
Romain

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants