I have a basic function im trying to run with node js and inquirer, and when i run it console log gives me this error. TypeError: inquirer.createPromptModule(...).then is not a function. I have seen a similar answer asked and the problem was there version of inquirer was old im running version 8.2.4 and im having the same issue. Any help would be appreciated.
const inquirer = require("inquirer");
const fs = require("fs");
const generateMarkdown = require ("./util/generateMarkdown.js");
const questions = [
{
type: "input",
message: "What is your Github username?",
name: "Username",
},
{
type: "input",
message: "What is your Email adress?",
name: "email"
},
{
type: "input",
message: "What is your projects name?",
name: "project",
},
{
type: "input",
message: "Description of your project:",
name: "description",
},
{
type: "checkbox",
message: "What license does your project require? (SPACEBAR to checkmark and ENTER to confirm)",
name: "license",
choices: ['MIT', 'APACHE 2.0', 'GPL 3.0', 'BSD 3', 'N/A'],
},
{
type: "input",
message: "What command should run dependencies?",
name: "install",
},
{
type: "input",
message: "what command should be used to run tests?",
name: "test",
},
{
type: "input",
message: "What does the user need to know about this repo?",
name: "use",
},
{
type: "input",
message: "How does the user contribute to this repo?",
name: "contribute",
},
];
function writeToFile(fileName, data) {
FontFaceSet.writeToFile(fileName, data, function (err) {
if (err) throw err;
console.log("File Created");
})
}
function init() {
inquirer.createPromptModule(questions).then((data) => {
const readmeFile = generateMarkdown(data);
writeToFile("generatedReadMe.md",readmeFile);
})
}
init();
Fixed after 45 mins of staring at the code i realized VSC auto completed and added CreatePromptModule when i was just trying to add prompt.