NodeJS debugger isn't recognising "prompt"

Problem description:
Students are trying to use breakpoints with debugger to analyse value of name variable. I’ve provided a simplified Repl that creates the same error at the link below.

Expected behavior:
Debugger runs the code which works when the regular run button is clicked.

Actual behavior:
The following error message is displayed in the console.

Steps to reproduce:

  1. Create new NodeJS repl
  2. Add the line name = prompt("Enter your name");
  3. Run the program to ensure it is working correctly.
  4. Click to the left of line 1 to set a breakpoint
  5. Open debugger and click the play button to start the debugger
  6. Look at console and see the error message

Bug appears at this link:

Chrome 109.0.5414.75 (Official Build) (64-bit); Windows 10; Desktop PC


This might be because NodeJS doesn’t actually have a built-in prompt function, Replit has managed to implement it in the NodeJS templates, however it isn’t actually a part of NodeJS.

Some quick google searching has shown the NPM package readline-sync to be probably one of the best and easiest alternatives:

const readline = require("readline-sync");

const input = readline.question("Enter some input: ");

Edit: Actually, this is not the issue, I ran the linked Repl and it worked fine, no errors.

Interesting! So do you get the same debugger error when you set a breakpoint on e.g. line 1?