Expected vs Current Behavior:
Steps to reproduce:
Bug appears at this link: https://replit.com/~
Browser/OS/Device: Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.96.36.199 Mobile Safari/537.36
Replit Profile: https://replit.com/@sagarkheyal6013
Hey @sagarkheyal6013 welcome to the forums!
Thank you for your post and sorry that you are experiencing issues. However, the Replit support team may not be able to help you with this issue if you do not complete the template fields fully.
Without knowing the expected and actual behavior (screenshots are fine for this section) as well as the link to your Repl and the steps a member of the support team will need to follow to reproduce the error there won’t be much we can do to help you.
The more information you provide at the start, the easier it will be to identify if your bug report is an issue or a misunderstanding.
This is the only repl on the profile.
And the error is
ReferenceError: prompt is not defined, not just “exit status 1”
Anyway the problem is you made a nodejs repl but are trying to use functions like
prompt which only exist on browser js.
I (and my students) are seeing the same issue. For example, see a student’s Replit here.
I think this is a bug because as of a few days ago, prompt() was automatically imported and could be used within all node.js Replits. Please fix!
prompt() is not a built-in for node.js, as it’s a browser api. You can use
prompt() in html-css-js repls, since the js there will be running in the browser.
The closest thing to
prompt in node.js is this npm package prompt - npm
And this package does not have the same usage as the browser
CSharpIsGud - I understand what you are saying, but as of a few days ago we were all able to use the prompt() function within node.js Replits (and have been doing so for at least 2 years). So it seems like that function must have been in a built-in, since I never imported it myself?
prompt is not built-in to Node.js, Replit has previously automatically added
prompt to Node.js Repls. It is possible that an update to the template Repl has removed this and they intend to add it again later, otherwise, you can just use the
prompt-sync as a simple substitute.
const prompt = require("prompt-sync")();
Thank you, MattDESTROYER. Didn’t know about the prompt-sync library - that’s a great patch. I would like to know from the Replit staff if they are planning to add the prompt import back to node.js Replits? It was very convenient to have that function automatically imported for my beginner programmers.
Hey @tinaozhu, unfortunately staff have confirmed Replit is not planning on adding back built-in
prompt, so it looks like the
prompt-sync package is the simplest solution.
Got it, thank you so much MattDESTROYER, that’s unfortunate but good to know! I appreciate the tip!