'Why "REPL command prompt" doesn't work as expected?

I'm reading nodejs documentation but sometimes my code doesn't work as the doc expected.

ex. Run REPL from javascript file as the doc said, I'm adding the following code in my repl.js file:

const repl = require('repl');
const local = repl.start(prompt);

Then, running the file in the command line:

node repl.js

BUT

unfortunately, I'm facing an error!!!

const local = repl.start(prompt);
                         ^
ReferenceError: prompt is not defined

Am I doing something wrong here?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source