heapwolf / prompt-sync

a synchronous prompt for node.js
MIT License
218 stars 42 forks source link

ENXIO: no such device or address, open '/dev/tty' - Mac #46

Open chadmortimer opened 3 years ago

chadmortimer commented 3 years ago

Using default/blank config

When calling prompt() -> Uncaught Exception ENXIO: no such device or address, open '/dev/tty' - Mac

macOS Big Sur (11.4) node v14.15.4

Edihan-1990 commented 2 years ago

i have this one pretty the same.

node:internal/fs/utils:348 throw err; ^

Error: ENXIO: no such device or address, open '/dev/tty' at Object.openSync (node:fs:595:3) at prompt (/Users/edihan/repos/Hangman_AEK/node_modules/prompt-sync/index.js:67:10) at Object. (/Users/edihan/repos/Hangman_AEK/Hangman_AEK.js:35:24) at Module._compile (node:internal/modules/cjs/loader:1149:14) at Module._extensions..js (node:internal/modules/cjs/loader:1203:10) at Module.load (node:internal/modules/cjs/loader:1027:32) at Module._load (node:internal/modules/cjs/loader:868:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) at node:internal/main/run_main_module:23:47 { errno: -6, syscall: 'open', code: 'ENXIO', path: '/dev/tty' }

Node.js v18.10.0

dangtony98 commented 1 year ago

I just ran into the same issue as well — Was anyone able to resolve this?

PianoMan7 commented 1 year ago

I'm also having the same problem. Trying to create I/O tests on Replit and I'm getting the following error message:

Error: ENXIO: no such device or address, open '/dev/tty' at Object.openSync (node:fs:585:3) at prompt (/home/runner/Conditionals-Q2/node_modules/prompt-sync/index.js:67:10) at Object. (/home/runner/Conditionals-Q2/index.js:5:13) at Module._compile (node:internal/modules/cjs/loader:1105:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Module.require (node:internal/modules/cjs/loader:1005:19) at require (node:internal/modules/cjs/helpers:102:18)

throttlehead-dev commented 1 year ago

Putting down a marker here if anyone encounters this on non-interactive environments, which in my case i was accidentally running a build script that prompted for user input in my aws CodeBuild project. This likely arises when using the library in such environment and it dies because there is nothing to prompt.

Update your script to ignore the prompt call in a non-interactive environment.