Yeoman - 在循环依赖中访问不存在的 属性 ____ 模块导出

Yeoman - Accessing non-existent property ____ of module exports inside circular dependency

哟! 我正在尝试yeoman and I'm making a test generator, but as I reported in this issue,有个小问题

这是我的代码:

const Generator = require('yeoman-generator');

module.exports = class extends Generator {
    // The name `constructor` is important here
    constructor(args, opts) {
        // Calling the super constructor is important so our generator is correctly set up
        super(args, opts);

        // Next, add your custom code
        this.argument("appname", {type: String, required: false});
    }

    async prompting(){
        const answers = await this.prompt([
            {
                type: "input",
                name: "name",
                message: "Your project name",
                default: this.appname
            },
            {
                type: "confirm",
                name: "cool",
                message: "Would you like to enable the Cool Feature?"
            },
            {
                type: "list",
                name: "features",
                message: "What do you want to make today?",
                choices: [
                    "Some tests",
                    "Other tests, why not!",
                    "Another test?",
                    "Yes."
                ]
            },
            {
                type: "checkbox",
                name: "more",
                message: "Anything more?",
                choices: [
                    {
                        name: "I'm a bit bored",
                        value: "bored",
                        checked: true
                    },
                    {
                        name: "I'm busy doing something else.",
                        value: "smthelse",
                        checked: false
                    }
                ]
            }
        ]);
        this.log("app name", answers.name);
        this.log("cool feature", answers.cool);
        this.log("feature", answers.features);
        this.log("more", answers.more.join(" + "))
    }
};

基本上,它应该直接提示我问题。但是之前,我得到了很多错误。

问题之前的输出如下所示:

(node:35760) Warning: Accessing non-existent property 'cat' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:35760) Warning: Accessing non-existent property 'cd' of module exports inside circular dependency
(node:35760) Warning: Accessing non-existent property 'chmod' of module exports inside circular dependency
(node:35760) Warning: Accessing non-existent property 'cp' of module exports inside circular dependency
(node:35760) Warning: Accessing non-existent property 'dirs' of module exports inside circular dependency
(node:35760) Warning: Accessing non-existent property 'pushd' of module exports inside circular dependency
(node:35760) Warning: Accessing non-existent property 'popd' of module exports inside circular dependency
(node:35760) Warning: Accessing non-existent property 'echo' of module exports inside circular dependency
(node:35760) Warning: Accessing non-existent property 'tempdir' of module exports inside circular dependency
(node:35760) Warning: Accessing non-existent property 'pwd' of module exports inside circular dependency
(node:35760) Warning: Accessing non-existent property 'exec' of module exports inside circular dependency
(node:35760) Warning: Accessing non-existent property 'ls' of module exports inside circular dependency
(node:35760) Warning: Accessing non-existent property 'find' of module exports inside circular dependency
(node:35760) Warning: Accessing non-existent property 'grep' of module exports inside circular dependency
(node:35760) Warning: Accessing non-existent property 'head' of module exports inside circular dependency
(node:35760) Warning: Accessing non-existent property 'ln' of module exports inside circular dependency
(node:35760) Warning: Accessing non-existent property 'mkdir' of module exports inside circular dependency
(node:35760) Warning: Accessing non-existent property 'rm' of module exports inside circular dependency
(node:35760) Warning: Accessing non-existent property 'mv' of module exports inside circular dependency
(node:35760) Warning: Accessing non-existent property 'sed' of module exports inside circular dependency
(node:35760) Warning: Accessing non-existent property 'set' of module exports inside circular dependency
(node:35760) Warning: Accessing non-existent property 'sort' of module exports inside circular dependency
(node:35760) Warning: Accessing non-existent property 'tail' of module exports inside circular dependency
(node:35760) Warning: Accessing non-existent property 'test' of module exports inside circular dependency
(node:35760) Warning: Accessing non-existent property 'to' of module exports inside circular dependency
(node:35760) Warning: Accessing non-existent property 'toEnd' of module exports inside circular dependency
(node:35760) Warning: Accessing non-existent property 'touch' of module exports inside circular dependency
(node:35760) Warning: Accessing non-existent property 'uniq' of module exports inside circular dependency
(node:35760) Warning: Accessing non-existent property 'which' of module exports inside circular dependency

我想知道为什么要这样做。

在此先感谢您的帮助!

警告来自节点v14.x.x 我也不知道节点作者为什么要这样设计。 现在,我只是将节点版本从 v14.x 切换到 v12.x 或 v13.x,警告消失了。