"Cannot read property 'pipe' of undefined" - Error
hello devs of Inquirer JS, I am make a password-manager for my self. When I found this error and not use pipe anywhere, the file which had the error was "/home/manav/code/password-manager/node_modules/inquirer/lib/ui/prompt.js". I am also going to my code.
index.js -
try {
require('dotenv').config();
const questions = require('./utils/questions');
const { prompt } = require('./utils/promtShell')
master = prompt(questions[0]);
if (master == process.env.MASTERPASS) {
console.log("Good.");
}
} catch (e) {
console.log(e);
}
promtShell.js -
const inquirer = require('inquirer');
module.exports.prompt = function (question) {
const shellInput = inquirer.createPromptModule();
let ans;
shellInput(question)
.then(anss => {
ans = anss;
})
.catch(e => {
console.log(e);
})
return ans;
}
questions.js -
module.exports = {
mpq: "Plz enter the mater password: "
}
Could you paste the error trace as is?
TypeError: Cannot read property 'pipe' of undefined
at PromptUI.run (/home/manav/code/password-manager/node_modules/inquirer/lib/ui/prompt.js:46:24)
at promptModule (/home/manav/code/password-manager/node_modules/inquirer/lib/inquirer.js:33:24)
at module.exports.prompt (/home/manav/code/password-manager/utils/promtShell.js:7:5)
at Object.