Inquirer.js icon indicating copy to clipboard operation
Inquirer.js copied to clipboard

When I run @inquirer/confirm I get an error.

Open kimulaco opened this issue 4 years ago • 0 comments

Enviroment

  • @inquirer/confirm: 0.0.9-alpha.0 (lasted)

About

If you use @inquirer/confirm by itself, you will get the following error:

(node:71948) UnhandledPromiseRejectionWarning: TypeError: [view(...)].flat is not a function
    at workLoop (/Users/username/project-name/node_modules/@inquirer/core/hooks.js:116:47)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
    at Function.Module.runMain (module.js:695:11)
    at startup (bootstrap_node.js:191:16)
    at bootstrap_node.js:612:3
(node:71948) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:71948) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
readline.js:1020
            throw err;

The executed code is the next code.

const confirm = require('@inquirer/confirm');

const main = async () => {
    try {
        const answer = await confirm({
            message: 'Enter your name',
            default: false,
        });
        console.error(answer);
    } catch (error) {
        console.error('Catch');
        console.error(error);
    }
};

main();

The process is not terminated because try...catch does not catch it.

kimulaco avatar Jun 18 '20 02:06 kimulaco