Open AlfonsoC06 opened 2 years ago
I am not sure about import approach, but I faced a similar issue when using prompt with require. The way it is intended to work is like this.
const prompt_fn = require('prompt-sync');
const prompt = prompt_fn();
I was having the same problem. Your answer helped me a lot! Thanks!
Previously answered https://github.com/heapwolf/prompt-sync/issues/29 for both types of import (require and es6 module).
Code: import prompt from 'prompt-sync';
var gender = prompt('Are you a male or a female? (M - male, F - female)');
if(gender == 'M' || gender == 'F'){ console.log(gender); } else { console.log('Try again!'); }
Error:
var autocomplete = config.autocomplete = ^
TypeError: Cannot create property 'autocomplete' on string 'Are you a male or a female? (M - male, F - female)'