-
Notifications
You must be signed in to change notification settings - Fork 182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not registering the second option in prompt.get([optiion1,option2])....etc #131
Comments
Im having the same problem,Admins should probably merge my issue #132 into this as it looks to be the same thing... sorry I tried searching but didn't see this until I was looking at my issue again today. I "fixed" it by doing something like this by adding the second parameter as "bug" prompt.get(['username', 'bug', 'email'], function (err, result) {
//
// Log the results.
//
console.log('Command-line input received:');
console.log(' username: ' + result.username);
console.log(' ignore: ' + result.bug);
console.log(' email: ' + result.email);
}); |
Noticed on one of my other computers using an older version of node, the problem doesn't exist. Im going to upgrade and see if it returns. Also error happened on my windows machine. My linux machine with the older node,js works fine (node -v = 0.12.7-1) |
Tested with linux node version 4.2.1 Also works fine. @mikeRead are you running it on windows? |
Thanks, I am running on windows using node v4.1.1 |
I test on windows with node v4.2.1 and the bug happened. |
I also appear to be hitting this bug on Windows 10, running Node 4.2.1. Issue existed in both Command Prompt, as well as in PowerShell. |
This bug has something to do with the way the prompt is initialized - it only occurs after the first input. var promptSchema = {
properties: {
"Mission name": {
pattern: /^[a-zA-Z\s\-]+$/,
message: 'Name must be only letters, spaces, or dashes',
required: true
},
"Skip this prompt": {
},
"Admin username": {
required: true
},
"Admin PIN": {
required: true
}
}
}; Running prompt with this schema and entering invalid input into the first prompt ("Mission name") causes the error message to pop up, then immediately pop up again (because the program outputs the error but also receives it as input, which is invalid based on that pattern). Entering correct input afterwards and you get through all four prompts. |
Its a bit off topic but you probably need to use description if your keys have space in them ...
//remove space
"Mission_name": {
//add description
description:"Mission name",
pattern: /^[a-zA-Z\s\-]+$/,
message: 'Name must be only letters, spaces, or dashes',
required: true
},
... |
Hmm. I ran node using the "Git Bash" program that comes shipped with Github's Windows desktop program and the bug seems to be gone. |
I'm not sure exactly what you mean but running |
I'm talking about the command prompt window. If you install Github for Windows, you also receive "Git Bash" which a port of the Linux-style environment/command-line tools. Node version 4.2.1 |
On all of my command prompts this error happens. Especially annoying when trying to type in passwords! Command Prompt, PowerShell, Git and CMDer all display this bug. Any ETA on this being fixed? Running Windows 10 64bit with Node 5.0.0 |
I'm also using windows 10 64bit but i have Node 4.2.2. I'm working on a project for a course and it keeps skipping the second parameter |
Windows 10 64bit but i have Node 4.2.2, same problem here. |
Upgrading to Node 5.3.0 fixed this for me. Was previously getting this error on Node 4.0.0 on Win 10. |
I had the same issue, I upgraded from Node 4.1.2 => 5.5.0 and the bug is gone. |
still an issue with node@4.2.6? |
Not sure if/how to resolve this one. It sounds like some magic in Node 5 fixes it, but I don't have a Windows machine to verify that it works or not on any version of Node. Anybody still having the problem on Node 5? |
I'm going to go ahead and close since we have a fix (Windows users upgrade to Node 5). It doesn't give me warm feelings that the root cause wasn't found, but at least we have an answer for anyone else with the problem. We can always reopen to keep the discussion going if anyone disagrees. |
'prompt' package is useless in windows. Use 'inquirer' for better results |
@edupoly or https://www.npmjs.com/package/prompt-ajv for a light and simple alternative |
Allows me to enter in the first option value, but once i click enter to move to the following option2, it just returns, showing the second option as a blank value. I added three options and it still skipped the second one and worked find for the third which is also odd.
I used this code to test:
The text was updated successfully, but these errors were encountered: