Prompt not working in nodejs

Question: The output is showing me that my prompt command not found…How can I fix this…I am a beginner??

Repl link/Link to where the bug appears:

Screenshots, links, or other helpful context:

code snippet

Hey, @DipiJakhar welcome to the forums!

Can you please provide a link to the repl? This way it is easier for staff and members of the community to help you!

Also see this guide on how to share your code:

1 Like

Hi @DipiJakhar , welcome to the forums!
There is also a similar problem:

@DipiJakhar Could you try what I have suggested here?


I have attempted to utilize the previous version of Replit, but regrettably, I have encountered the same error consistently. I encourage you to experiment with the prompt within your own code, as you will likely encounter the same issue. This appears to be a widespread bug that affects multiple users.

This is not a bug. prompt is not a Node.js function. It is a vanilla JS function. If you would like to use it, use vanilla JS, or, put this on line 1:

const prompt = require('prompt-sync')()
1 Like

You’ll need to use the prompt-sync library.

const prompt=require('prompt-sync')()
prompt('Enter your name:')

Hope this helps!

However, the Prompt function performed seamlessly for me, even when I was utilizing Node.js and pure JavaScript.

Yes. Replit used to automatically add prompt and alert to Node.js Repls. They have since stopped doing that.