1771771771
Deno3y ago
4 replies
177177177

Error when using readline.question()

I get this error with the following code
import process from 'node:process'
import readline from 'node:readline'

let intf = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});

intf.question('Enter name :', name => console.log(name))

error: Uncaught ReferenceError: process is not defined
  intf.question('Enter name :', name => console.log(name))
       ^
    at Interface.prompt (ext:deno_node/internal/readline/interface.mjs:377:26)     
    at Interface.[kQuestion] (ext:deno_node/internal/readline/interface.mjs:395:12)
    at Interface.question (ext:deno_node/_readline.mjs:144:20)
    at file:///C:/my_project_path/main.ts:39:7
    at ext:deno_node/_fs/_fs_readFile.ts:29:25
    at eventLoopTick (ext:core/01_core.js:181:11)
NativeCommandExitException: Program "deno.exe" ended with non-zero exit code: 1.
Was this page helpful?