我是npm inquirer
第一次使用。
我正在使用与此类似的代码:
const inquirer = require("inquirer");
const questions = [
{
type: "checkbox",
name: "collections.telemetria",
message: "Select collections of database telemetria",
choices: [
"chimera-11/14/2019,-4:22:38-PM",
"chimera-11/14/2019,-4:28:26-PM"
]
},
{
type: "checkbox",
name: "collections.testa",
message: "Select collections of database testa",
choices: ["testa_c"]
}
];
async function main() {
const collections = (await inquirer.prompt(questions)).collections;
console.log("collections:", collections);
const outPath = await inquirer.prompt([
{
type: "input",
name: "outPath",
default: "./",
message: "Insert the output path"
}
]).outPath;
console.log(outPath);
}
main();
问题是,当涉及到要回答的类型输入的问题时,出现了 undefined 这个词,我无法输入任何内容。